[llvm] [ELF]Add overflow check to ELF note iterator (PR #160451)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 02:48:49 PDT 2025


================
@@ -368,13 +368,13 @@ TEST(ELFObjectFileTest, ELFNoteIteratorOverflow) {
                               .str());
   };
 
-  auto PhdrsOrErr = Obj.program_headers();
+  Expected<ELFFile<ELF64LE>::Elf_Phdr_Range> PhdrsOrErr = Obj.program_headers();
   EXPECT_FALSE(!PhdrsOrErr);
   for (auto P : *PhdrsOrErr)
----------------
jh7370 wrote:

Still using `auto` here and in the similar loop below. You could probably add a couple of `using` declarations to avoid repeating the full `ELFFile<ELF64LE>::Elf_Phdr_Range` and Shdr equivalent.

https://github.com/llvm/llvm-project/pull/160451


More information about the llvm-commits mailing list