Skip to content

Commit ae0b263

Browse files
[BitcodeReader] Add bounds checking on Strtab (#76403)
This is needed to protect against global overflows, which was found by a fuzzer recently. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65283 --------- Signed-off-by: David Korczynski <[email protected]>
1 parent 2df0fa4 commit ae0b263

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4218,6 +4218,9 @@ Error BitcodeReader::parseGlobalIndirectSymbolRecord(
42184218

42194219
// Check whether we have enough values to read a partition name.
42204220
if (OpNum + 1 < Record.size()) {
4221+
// Check Strtab has enough values for the partition.
4222+
if (Record[OpNum] + Record[OpNum + 1] > Strtab.size())
4223+
return error("Malformed partition, too large.");
42214224
NewGA->setPartition(
42224225
StringRef(Strtab.data() + Record[OpNum], Record[OpNum + 1]));
42234226
OpNum += 2;

0 commit comments

Comments
 (0)