[Toybox] [PATCH] file(1): call out apparently invalid ELF files.

enh enh at google.com
Wed Mar 16 19:18:45 PDT 2022


Realistically, corrupt ELF files are rare enough that it's more likely
that we've actually found a bug in file(1), such as the .bss bug fixed
in the previous patch. That bug went undiscovered so long because we
silently give up on ELF files we don't understand, and the output didn't
look obviously broken even if you'd been told it was broken and were
looking at it.

Give up noisily instead so we find and fix any future bugs more quickly.

Also remove some duplicated code: the commit that switched to mmap(2)
rather than lseek(2) had two copies of the mmap call.
---
 toys/posix/file.c | 51 +++++++++++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 17 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20220316/5ea89f81/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-file-1-call-out-apparently-invalid-ELF-files.patch
Type: text/x-patch
Size: 5362 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20220316/5ea89f81/attachment.bin>


More information about the Toybox mailing list