forked from OSchip/llvm-project
8702574557
And update the existing test cases in test/Object/macho-invalid.test to use llvm-objdump with the -macho option to produce these error messages and stop producing the generic "Invalid data was encountered while parsing the file" message. Working from the beginning of the file, if the mach header is too large for the size of the file and then if the load commands that follow extend past the end of the file these two errors now generate correct error messages. Both of these have existing test cases in test/Object/macho-invalid.test . But the first with macho-invalid-header it will never trigger the error message "mach header extends past the end of the file" using any of the llvm tools as they all use identify_magic() which rejects files with the correct magic number that are too small in size. So I tested this by hacking that code and seeing the error message down in parseHeader() really does happen. So in case there is ever code in llvm that directly calls createMachOObjectFile() this error message will be correctly produced. The second error message of "load commands extends past the end of the file" is triggered by a number of existing tests cases in test/Object/macho-invalid.test . Also other tests trigger different error messages now like "ilocalsym plus nlocalsym in LC_DYSYMTAB load command extends past the end of the symbol table". There are two existing test cases that still get the "Invalid data was encountered ..." error messages that I will tackle next. But they will involve a bit of pluming an Expect<...> up through the call stack and I want to do those as separate changes. FYI, for those test cases that were trying to test specific errors that now get different errors I’ll fix those in follow on changes and create new test cases for those so they test the error they were meant to test. llvm-svn: 266248 |
||
---|---|---|
.. | ||
Archive.cpp | ||
ArchiveWriter.cpp | ||
Binary.cpp | ||
CMakeLists.txt | ||
COFFObjectFile.cpp | ||
ELF.cpp | ||
ELFObjectFile.cpp | ||
Error.cpp | ||
IRObjectFile.cpp | ||
LLVMBuild.txt | ||
MachOObjectFile.cpp | ||
MachOUniversal.cpp | ||
ModuleSummaryIndexObjectFile.cpp | ||
Object.cpp | ||
ObjectFile.cpp | ||
RecordStreamer.cpp | ||
RecordStreamer.h | ||
SymbolSize.cpp | ||
SymbolicFile.cpp |