diff --git a/.vscode/launch.json b/.vscode/launch.json index 53ad78abd0ed5e942c41a9eeab01ac3ea4177d4e..53bfb3173cfe64c053867ec938f3773ac4eb5fba 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -102,7 +102,7 @@ "request": "launch", "program": "${workspaceFolder}/tests/elfio_fuzzer", "args": [ - "oom-9025696a52c7f5cb94d482225a6b3727e9691f5b" + "oom-7ff496ad1166860893dba1121d088da4ce9fef65" ], "cwd": "${workspaceFolder}/tests", } diff --git a/elfio/elfio_note.hpp b/elfio/elfio_note.hpp index db523145de4aec0aa297df2b1b4e886b0ef8443e..fc00526c187b8e9681c99bd82cf3f67d1676fc6a 100644 --- a/elfio/elfio_note.hpp +++ b/elfio/elfio_note.hpp @@ -152,9 +152,12 @@ class note_section_accessor_template (Elf_Xword)3 * sizeof( Elf_Word ) + ( ( namesz + align - 1 ) / align ) * (Elf_Xword)align + ( ( descsz + align - 1 ) / align ) * (Elf_Xword)align; - if ( current + advance <= size ) { + if ( namesz < size && descsz < size && current + advance <= size ) { note_start_positions.emplace_back( current ); } + else { + break; + } current += advance; }