endeav0r/rdis — pull request #3 by phillipberndt (2013-06-02 18:43:03+00:00)
Title: rdis segfault with invalid call address

I have a library for which rdis crashes. The library is proprietary, so I can't attach it to this bug report, but I guess I can email you a copy if you'd like one. The important thing for this bug report is that it apparently does an invalid function call somewhere, which causes rdis to crash.

I've been able to pinpoint the problem to `elf64_label_address`, which references `elf64->data[address - elf64_base_address(elf64)]` without checking if the address is within the bounds of `data`. A later call to udis86 then tries to access the memory, causing a segfault.

My proposed patch adds code to check whether the address is positive and bounded by `elf64->data_size`.