https://sourceware.org/bugzilla/show_bug.cgi?id=28542
Bug ID: 28542 Summary: Undefined behaviours in readelf.c Product: binutils Version: 2.38 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: shaohua.li at inf dot ethz.ch Target Milestone: --- Created attachment 13758 --> https://sourceware.org/bugzilla/attachment.cgi?id=13758&action=edit poc_undefined Hi there, I compiled binutils (git Head) with -fsanitize=undefined, and found the sanitizer complained on two locations in readelf.c. Another consequence of this issue is: if you compile binutils with gcc11, you would find their outputs are different. - Compiler: clang13 (compile with -fsanitize=undefined) - Platform: Ubuntu 20.04.3 LTS, x86_64 - Reproduce: run `readelf -aD poc_undefined | grep Undefined` Undefined sanitizer report: =============== readelf.c:1761:15: runtime error: applying non-zero offset 320 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior readelf.c:1761:15 in 861,863c85 readelf.c:12635:18: runtime error: applying non-zero offset 320 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior readelf.c:12635:18 -- You are receiving this mail because: You are on the CC list for the bug.