[PATCH] libdw: Report error in dwarf_getlocation_die for bogus opcode offset.

2018-06-06 Thread Mark Wielaard
Found by afl fuzzer on varlocs test. varlocs sanity checks that the given offset in the opcode corresponds to the cuoffset of the returned DIE. In case the opcode offset was bogus this might fail because we might wrap around and return a random DIE instead of reporting an error. Signed-off-by: Mar

[PATCH] tests: Use error, not assert, when trying to print a non-base type DIE.

2018-06-06 Thread Mark Wielaard
When using the varlocs test with a fuzzer using assert for internal sanity checks is great to find issues. But when encountering bad data using an assert is wrong. Just use error to show we handle the data correctly (by reporting it is bad, instead of crashing). Signed-off-by: Mark Wielaard ---

Re: [PATCH] readelf: Don't allocate string with asprintf, but reuse buffer with sprintf.

2018-06-06 Thread Mark Wielaard
On Mon, Jun 04, 2018 at 07:05:16PM +0200, Mark Wielaard wrote: > Since we are single threaded we can just use a static result buffer for > format_dwarf_addr as long as we make sure to print the result before > calling format_dwarf_addr again. This removes lots of malloc/free calls. > > On my machi

Re: [PATCH] readelf: Lookup gettext "yes" and "no" only once.

2018-06-06 Thread Mark Wielaard
On Mon, Jun 04, 2018 at 06:57:27PM +0200, Mark Wielaard wrote: > On my machine eu-readelf -N --debug-dump=info libxul.so > /dev/null > goes from 63 seconds to 57 seconds. Pushed to master.

Re: [PATCH] readelf: Call __fsetlocking (stdout, FSETLOCKING_BYCALLER).

2018-06-06 Thread Mark Wielaard
On Mon, Jun 04, 2018 at 06:54:53PM +0200, Mark Wielaard wrote: > We only call printf on stdout from one thread, so we don't need internal > stdio locking for stdout. > > On my machine eu-readelf -N --debug-dump=info libxul.so > /dev/null > goes from 65 seconds to 63 seconds. Pushed to master.