authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-11 09:21:54+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-11 10:10:04+02:00
logc692aced232da210469b2c04270edc5a980b72d7
tree378bd2e5b703bc89b243d382de268096332cbea6
parent8b06537d92e3ab59694453154f17f51cce594cb9
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

compiler_rt.elf.tls: fix potential underflow if PT_TLS p_align is zero

Very unlikely with any sane linker, but technically allowed.

1 files changed, 1 insertions(+), 1 deletions(-)

lib/compiler_rt/elf/tls.zig+1-1
......@@ -499,7 +499,7 @@ fn computeAreaDesc(phdrs: []elf.ElfN.Phdr) void {
499499 var block_size: usize = undefined;
500500
501501 if (tls_phdr) |phdr| {
502 align_factor = phdr.@"align";
502 align_factor = @max(phdr.@"align", 1);
503503
504504 // The effective size in memory is represented by `memsz`; the length of the data stored
505505 // in the `PT.TLS` segment is `filesz` and may be less than the former.