Skip to content

Commit ea93ca6

Browse files
committed
[Bitcode] Fix size check for DIImportedEntity record
This was using && instead of ||.
1 parent 7224871 commit ea93ca6

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

llvm/lib/Bitcode/Reader/MetadataLoader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,8 +2033,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
20332033
break;
20342034
}
20352035
case bitc::METADATA_IMPORTED_ENTITY: {
2036-
if (Record.size() < 6 && Record.size() > 8)
2037-
return error("Invalid record");
2036+
if (Record.size() < 6 || Record.size() > 8)
2037+
return error("Invalid DIImportedEntity record");
20382038

20392039
IsDistinct = Record[0];
20402040
bool HasFile = (Record.size() >= 7);
Binary file not shown.

llvm/test/Bitcode/invalid.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-chunk-size.bc 2>&1 | \
286286
RUN: FileCheck --check-prefix=INVALID-CHUNK-SIZE %s
287287

288288
INVALID-CHUNK-SIZE: Fixed or VBR abbrev record with size > MaxChunkData
289+
290+
RUN: not llvm-dis -disable-output %p/Inputs/invalid-diimportedentity-record.bc 2>&1 | \
291+
RUN: FileCheck --check-prefix=INVALID-DIIMPORTEDENTITY-RECORD %s
292+
293+
INVALID-DIIMPORTEDENTITY-RECORD: Invalid DIImportedEntity record

0 commit comments

Comments
 (0)