Paulo César Pereira de Andrade
2017-04-06 19:24:03 UTC
Attached is an initial patch to rebuild using
https://github.com/google/sanitizers/wiki/AddressSanitizer
Tested on Fedora 26. Basically, add -fsanitize=address to
the CCFLAGS, and run under gdb like this:
$ ASAN_OPTIONS=abort_on_error=1 /path/to/ksh
This is not a complete patch, but with this one should
be able to run scripts and find more issues, that might
be harder to properly address.
This patch is mostly a s/memcmp/strncmp/ with some
checks for string length in a few places, and just to be
able to start ksh without a fatal error due to address errors.
A proper patch should replace all memcmp with strncmp,
unless it is proven that it cannot read unbound memory.
Thanks,
Paulo
https://github.com/google/sanitizers/wiki/AddressSanitizer
Tested on Fedora 26. Basically, add -fsanitize=address to
the CCFLAGS, and run under gdb like this:
$ ASAN_OPTIONS=abort_on_error=1 /path/to/ksh
This is not a complete patch, but with this one should
be able to run scripts and find more issues, that might
be harder to properly address.
This patch is mostly a s/memcmp/strncmp/ with some
checks for string length in a few places, and just to be
able to start ksh without a fatal error due to address errors.
A proper patch should replace all memcmp with strncmp,
unless it is proven that it cannot read unbound memory.
Thanks,
Paulo