[PATCH] D73502: [BinaryFormat] Limit COFF file detection with unknown machine type
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 09:58:26 PST 2020
efriedma added a comment.
llvm::identify_magic is not really a general-purpose file identification routine; it's specifically designed to sniff out the format of files which are interesting to LLVM tools, and it doesn't try very hard to figure out whether the input is valid. If it's returning file_magic::unknown, probably something has gone wrong elsewhere. That said, it would be nice to use more than two bytes to make a positive identification, if there's some other reliable indicator for a COFF object.
Are PE object files with IMAGE_FILE_MACHINE_UNKNOWN actually something that shows up in practice (besides the special case of "\0\0\xFF\xFF")? What would such a file contain? Can any LLVM tools do anything interesting with it?
If we're going to try to sniff out whether the COFF header is valid, should we do it for all coff_object files?
Is it reasonable to assume all COFF object files have at least one section? It's sort of degenerate, but it's possible to construct an empty object file.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73502/new/
https://reviews.llvm.org/D73502
More information about the llvm-commits
mailing list