[all-commits] [llvm/llvm-project] 535520: [llvm-objcopy] --gap-fill and 0-size sections (#75...
quic-akaryaki via All-commits
all-commits at lists.llvm.org
Tue Dec 19 13:30:44 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 535520c6636f9a2bd7cd8fcb221e598a372cae9e
https://github.com/llvm/llvm-project/commit/535520c6636f9a2bd7cd8fcb221e598a372cae9e
Author: quic-akaryaki <123192073+quic-akaryaki at users.noreply.github.com>
Date: 2023-12-19 (Tue, 19 Dec 2023)
Changed paths:
M llvm/lib/ObjCopy/ELF/ELFObject.cpp
M llvm/test/tools/llvm-objcopy/ELF/gap-fill.test
Log Message:
-----------
[llvm-objcopy] --gap-fill and 0-size sections (#75837)
In the change that added `--gap-fill`, the condition to choose the
sections to write in `BinaryWriter::write()` did not exclude zero-size
sections. However, zero-size sections did not have correct offsets
assigned in `BinaryWriter::finalize()`. The result is either a failed
assertion, or memory corruption due to writing to the buffer beyond its
size.
To fix this, exclude zero-size sections from writing. Also, add a zero-size
section to the test, which would trigger the problem.
More information about the All-commits
mailing list