Hi Paul, Hi Nafi, On Mon, 2023-11-13 at 22:58 +0000, Paul Pluzhnikov wrote: > When map_address is NULL, computing map_address+offset is technically > undefined behavior, and triggers Clang/LLVM warning when using > -fsanitize=pointer-overflow.
Urgh, I had no idea NULL + ... was technically undefined behavior. > Fix this by using uintptr_t to perform computations. I can see how this solves the the issue. It would be slightly nicer if we could just do the computation after checking map_address != NULL (since ehdr is only used after such a check). That would require rearranging some of the if statements. Does that make the code too complicated? Also this only resolves the issue for the 64bit ELF case. Just above this code is basically the same code for 32bit ELF. That code also needs to be fixed. Thanks, Mark