summaryrefslogtreecommitdiffstats
path: root/llvm/test/Bitcode/invalid.test
Commit message (Collapse)AuthorAgeFilesLines
* Add support for multi-module bitcode files to llvm-disMatthew Voss2019-11-141-5/+0
| | | | | | | | | | | | | | Summary: This change allows llvm-dis to disassemble multi-module bitcode files, including the associated module summary. Reviewers: tejohnson, pcc, mehdi_amini Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70153
* Recommit "[BitcodeReader] Validate OpNum, before accessing Record array."Florian Hahn2019-07-141-0/+5
| | | | | | | | | | | | | | | | | | | | | This recommits r365750 (git commit 8b222ecf2769ee133691f208f6166ce118c4a164) Original message: Currently invalid bitcode files can cause a crash, when OpNum exceeds the number of elements in Record, like in the attached bitcode file. The test case was generated by clusterfuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15698 Reviewers: t.p.northover, thegameg, jfb Reviewed By: jfb Differential Revision: https://reviews.llvm.org/D64507 llvm-svn: 365750jkkkk llvm-svn: 366018
* Revert [BitcodeReader] Validate OpNum, before accessing Record array.Florian Hahn2019-07-111-5/+0
| | | | | | | | | | | | This reverts r365750 (git commit 8b222ecf2769ee133691f208f6166ce118c4a164) llvm-dis runs out of memory while opening invalid-fcmp-opnum.bc on llvm-hexagon-elf, probably because the bitcode file contains other suspicious values. http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/21949 llvm-svn: 365757
* [BitcodeReader] Validate OpNum, before accessing Record array.Florian Hahn2019-07-111-0/+5
| | | | | | | | | | | | | | | Currently invalid bitcode files can cause a crash, when OpNum exceeds the number of elements in Record, like in the attached bitcode file. The test case was generated by clusterfuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15698 Reviewers: t.p.northover, thegameg, jfb Reviewed By: jfb Differential Revision: https://reviews.llvm.org/D64507 llvm-svn: 365750
* Bitcode: derive all types used from records instead of Values.Tim Northover2019-06-271-1/+1
| | | | | | | | | | | | | | | There is existing bitcode that we need to support where the structured nature of pointer types is used to derive the result type of some operation. For example a GEP's operation and result will be based on its input Type. When pointers become opaque, the BitcodeReader will still have access to this information because it's explicitly told how to construct the more complex types used, but this information will not be attached to any Value that gets looked up. This changes BitcodeReader so that in all places which use type information in this manner, it's derived from a side-table rather than from the Value in question. llvm-svn: 364550
* Fix Bitcode/invalid.testJF Bastien2019-06-261-6/+6
| | | | | | On the armv8 bot the failure is slightly different in the number it prints. Don't check the numbers. This was caused by r364464. llvm-svn: 364488
* BitStream reader: propagate errorsJF Bastien2019-06-261-7/+7
| | | | | | | | | | | | | | | | | | | | | | The bitstream reader handles errors poorly. This has two effects: * Bugs in file handling (especially modules) manifest as an "unexpected end of file" crash * Users of clang as a library end up aborting because the code unconditionally calls `report_fatal_error` The bitstream reader should be more resilient and return Expected / Error as soon as an error is encountered, not way late like it does now. This patch starts doing so and adopting the error handling where I think it makes sense. There's plenty more to do: this patch propagates errors to be minimally useful, and follow-ups will propagate them further and improve diagnostics. https://bugs.llvm.org/show_bug.cgi?id=42311 <rdar://problem/33159405> Differential Revision: https://reviews.llvm.org/D63518 llvm-svn: 364464
* Bitcode: Introduce initial multi-module reader API.Peter Collingbourne2016-11-161-11/+11
| | | | | | | | Implement getLazyBitcodeModule() and parseBitcodeFile() in terms of it. Differential Revision: https://reviews.llvm.org/D26719 llvm-svn: 287156
* Bitcode: Change the BitcodeReader to use llvm::Error internally.Peter Collingbourne2016-11-091-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D26430 llvm-svn: 286323
* Bitcode: Check file size before reading bitcode header.Peter Collingbourne2016-11-021-0/+3
| | | | | | | | Should unbreak ocaml binding tests. Also added an llvm-dis test that checks for the same thing. llvm-svn: 285777
* [BitCode] Make sure atomicrmw's argument is an actual PointerTypeFilipe Cabecinhas2016-06-051-0/+5
| | | | llvm-svn: 271851
* [BitCode] Make sure storeatomic's argument is an actual PointerTypeFilipe Cabecinhas2016-06-051-0/+5
| | | | llvm-svn: 271850
* [BitCode] Diagnose GEPs with no indicesFilipe Cabecinhas2016-06-051-0/+5
| | | | llvm-svn: 271849
* [BitCode] Don't allow constants of void type.Filipe Cabecinhas2016-06-051-0/+5
| | | | llvm-svn: 271848
* Support: Implement StreamingMemoryObject::getPointerDuncan P. N. Exon Smith2016-03-271-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation is fairly obvious. This is preparation for using some blobs in bitcode. For clarity (and perhaps future-proofing?), I moved the call to JumpToBit in BitstreamCursor::readRecord ahead of calling MemoryObject::getPointer, since JumpToBit can theoretically (a) read bytes, which (b) invalidates the blob pointer. This isn't strictly necessary the two memory objects we have: - The return of RawMemoryObject::getPointer is valid until the memory object is destroyed. - StreamingMemoryObject::getPointer is valid until the next chunk is read from the stream. Since the JumpToBit call is only going ahead to a word boundary, we'll never load another chunk. However, reordering makes it clear by inspection that the blob returned by BitstreamCursor::readRecord will be valid. I added some tests for StreamingMemoryObject::getPointer and BitstreamCursor::readRecord. llvm-svn: 264549
* Revert "Bitcode: Collect all MDString records into a single blob"Duncan P. N. Exon Smith2016-03-251-0/+5
| | | | | | | This reverts commit r264409 since it failed to bootstrap: http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/8302/ llvm-svn: 264410
* Bitcode: Collect all MDString records into a single blobDuncan P. N. Exon Smith2016-03-251-5/+0
| | | | | | | | | | | | | | | | | | | | | | | Optimize output of MDStrings in bitcode. This emits them in big blocks (currently 1024) in a pair of records: - BULK_STRING_SIZES: the sizes of the strings in the block, and - BULK_STRING_DATA: a single blob, which is the concatenation of all the strings. Inspired by Mehdi's similar patch, http://reviews.llvm.org/D18342, this should (a) slightly reduce bitcode size, since there is less record overhead, and (b) greatly improve reading speed, since blobs are super cheap to deserialize. I needed to add support for blobs to streaming input to get the test suite passing. - StreamingMemoryObject::getPointer reads ahead and returns the address of the blob. - To avoid a possible reallocation of StreamingMemoryObject::Bytes, BitstreamCursor::readRecord needs to move the call to JumpToEnd forward so that getPointer is the last bitstream operation. llvm-svn: 264409
* Error out when faced with value names containing '\0'Filipe Cabecinhas2015-11-041-0/+5
| | | | | | Bug found with afl-fuzz. llvm-svn: 252048
* Don't assert if materializing before seeing any function bodiesFilipe Cabecinhas2015-11-031-0/+5
| | | | | | | | | This assert was reachable from user input. A minimized test case (no FUNCTION_BLOCK_ID record) is attached. Bug found with afl-fuzz llvm-svn: 251910
* Revert "Don't assert if materializing before seeing any function bodies"Filipe Cabecinhas2015-10-301-5/+0
| | | | | | This reverts r251667 since it broke the bots. llvm-svn: 251671
* Don't assert if materializing before seeing any function bodiesFilipe Cabecinhas2015-10-291-0/+5
| | | | | | | | | This assert was reachable from user input. A minimized test case (no FUNCTION_BLOCK_ID record) is attached. Bug found with afl-fuzz llvm-svn: 251667
* Make sure the CastInst is valid before trying to create itFilipe Cabecinhas2015-10-061-0/+5
| | | | | | Bug found with afl-fuzz. llvm-svn: 249396
* [BitcodeReader] Diagnose type mismatches with aliasesFilipe Cabecinhas2015-06-031-0/+5
| | | | | | Bug found with AFL fuzz. llvm-svn: 238895
* [BitcodeReader] Check vector size before trying to create a VectorTypeFilipe Cabecinhas2015-06-031-0/+5
| | | | | | Bug found with AFL fuzz llvm-svn: 238891
* [BitcodeReader] Change an assert to a call to a call to Error()Filipe Cabecinhas2015-05-301-0/+5
| | | | | | | | It's reachable from user input. Bug found with AFL fuzz. llvm-svn: 238633
* [BitcodeReader] Change assert to report_fatal_errorFilipe Cabecinhas2015-05-271-0/+5
| | | | | | | | It can be triggered by user input. Bug found with AFL fuzz. llvm-svn: 238272
* [BitstreamReader] Make sure the Array operand type is an encodingFilipe Cabecinhas2015-05-271-0/+5
| | | | | | Bug found with AFL fuzz. llvm-svn: 238269
* [BitcodeReader] Make sure abbrev records have at least one operand (record code)Filipe Cabecinhas2015-05-261-0/+5
| | | | | | Bug found with AFL fuzz. llvm-svn: 238265
* [BitcodeReader] Sanity check on Comdat IDFilipe Cabecinhas2015-05-261-0/+10
| | | | | | | | Shouldn't be an assert, since user input can trigger it. Bug found with AFL fuzz. llvm-svn: 238261
* Change a reachable unreachable to a fatal error.Filipe Cabecinhas2015-05-191-0/+5
| | | | | | | | | | | | | | | Summary: Also tagged a FIXME comment, and added information about why it breaks. Bug found using AFL fuzz. Reviewers: rafael, craig.topper Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9729 llvm-svn: 237709
* [BitcodeReader] Error out if we read an invalid function argument typeFilipe Cabecinhas2015-05-191-0/+5
| | | | | | Bug found with AFL fuzz. llvm-svn: 237650
* [BitcodeReader] It's a malformed block if CodeLenWidth is too bigFilipe Cabecinhas2015-05-191-0/+5
| | | | | | Bug found with AFL fuzz. llvm-svn: 237646
* [BitcodeReader] Make sure the type of the inserted value matches the type of ↵Filipe Cabecinhas2015-05-181-0/+5
| | | | | | | | the aggregate at those indices Bug found with AFL-fuzz. llvm-svn: 237628
* Extract the load/store type verification to a separate function.Filipe Cabecinhas2015-05-181-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Added isLoadableOrStorableType to PointerType. We were doing some checks in some places, occasionally assert()ing instead of telling the caller. With this patch, I'm putting all type checking in the same place for load/store type instructions, and verifying the same thing every time. I also added a check for load/store of a function type. Applied extracted check to Load, Store, and Cmpxcg. I don't have exhaustive tests for all of these, but all Error() calls in TypeCheckLoadStoreInst are being tested (in invalid.test). Reviewers: dblaikie, rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9785 llvm-svn: 237619
* [BitcodeReader] Don't allow INSERTVAL/EXTRACTVAL with 0 indicesFilipe Cabecinhas2015-05-161-0/+10
| | | | | | | | This would trigger an assertion later. Bug found with AFL fuzz. llvm-svn: 237494
* Don't overflow GCTableFilipe Cabecinhas2015-04-301-0/+5
| | | | | | | | | | | | Summary: Bug found with AFL fuzz. Reviewers: rafael, dexonsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9361 llvm-svn: 236200
* Make sure Op->getType() is a PointerType before we cast<> it.Filipe Cabecinhas2015-04-301-0/+5
| | | | | | Bug found with AFL fuzz. llvm-svn: 236193
* Make sure we don't resize(0) when we get a fwdref with Idx == UINT_MAXFilipe Cabecinhas2015-04-301-0/+5
| | | | | | | | Make it an error instead. Bug found with AFL fuzz. llvm-svn: 236190
* Check that we have a valid PointerType element type before calling get()Filipe Cabecinhas2015-04-291-0/+2
| | | | | | | | Same as r236073 but for PointerType. Bug found with AFL fuzz. llvm-svn: 236079
* Turn an assert into report_fatal_error since it's reachable based on user inputFilipe Cabecinhas2015-04-291-0/+5
| | | | | | Bug found with AFL fuzz. llvm-svn: 236076
* Make sure that isValidElementType(Type) before calling ↵Filipe Cabecinhas2015-04-291-0/+7
| | | | | | | | {Array,Struct}Type::get(Type) Bug found with AFL fuzz. llvm-svn: 236073
* Relax an assert when there's a type mismatch in forward referencesFilipe Cabecinhas2015-04-281-0/+5
| | | | | | | | | | | | | | | | Summary: We don't seem to need to assert here, since this function's callers expect to get a nullptr on error. This way we don't assert on user input. Bug found with AFL fuzz. Reviewers: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9308 llvm-svn: 236027
* [opaque pointer type] bitcode: add explicit callee type to invoke instructionsDavid Blaikie2015-04-241-0/+6
| | | | llvm-svn: 235735
* [BitcodeReader] Fix asserts when we read a non-vector type for ↵Filipe Cabecinhas2015-04-241-0/+9
| | | | | | | | | | insert/extract/shuffle Added some additional checking for vector types + tests. Bug found with AFL fuzz. llvm-svn: 235710
* Be more strict about the operand for the array type in BitcodeReaderFilipe Cabecinhas2015-04-231-0/+5
| | | | | | | | | | | | Summary: Bug found with AFL fuzz. Reviewers: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9016 llvm-svn: 235596
* Verify sizes when trying to read a BitcodeAbbrevOpFilipe Cabecinhas2015-04-231-0/+7
| | | | | | | | | | | | | | | | Summary: Make sure the abbrev operands are valid and that we can read/skip them afterwards. Bug found with AFL fuzz. Reviewers: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9030 llvm-svn: 235595
* Have more strict type checks when creating BinOp nodes in BitcodeReaderFilipe Cabecinhas2015-04-221-0/+5
| | | | | | | | | | | | Summary: Bug found with AFL. Reviewers: rafael, bkramer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9015 llvm-svn: 235489
* [opaque pointer type] Explicit pointee type for call instructionDavid Blaikie2015-04-171-0/+6
| | | | | | | | | | Use an extra bit in the CCInfo to flag the newer version of the instructiont hat includes the type explicitly. Tested the newer error cases I added, but didn't add tests for the finer granularity improvements to existing error paths. llvm-svn: 235160
* Revert "Verify sizes when trying to read a VBR"Filipe Cabecinhas2015-04-151-5/+0
| | | | | | | This reverts r234984 since it seems to break some bots (most of them seemed arm*-selfhost). llvm-svn: 234998
* Verify sizes when trying to read a VBRFilipe Cabecinhas2015-04-151-0/+5
| | | | | | Also added an assert to ReadVBR64. llvm-svn: 234984
OpenPOWER on IntegriCloud