[llvm] [llvm][ELF]Add Shdr check for getBuildID (PR #126537)
Ruoyu Qiu via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 22 01:31:53 PDT 2025
================
@@ -407,7 +407,8 @@ class ELFFile {
Elf_Note_Iterator notes_begin(const Elf_Phdr &Phdr, Error &Err) const {
assert(Phdr.p_type == ELF::PT_NOTE && "Phdr is not of type PT_NOTE");
ErrorAsOutParameter ErrAsOutParam(Err);
- if (Phdr.p_offset + Phdr.p_filesz > getBufSize()) {
+ if (Phdr.p_offset + Phdr.p_filesz > getBufSize() ||
+ Phdr.p_offset + Phdr.p_filesz < Phdr.p_offset) {
----------------
cabbaken wrote:
This serves as an overflow check, and the unit test would fail without it. Do you think I should create a separate PR to merge this check first?
https://github.com/llvm/llvm-project/pull/126537
More information about the llvm-commits
mailing list