[llvm] [DWARFLibrary] Add bounds check to Contrib index (PR #76405)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 26 11:46:30 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-debuginfo
Author: None (DavidKorczynski)
<details>
<summary>Changes</summary>
Index should be within the range of Contrib before being used as an index.
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30308
---
Full diff: https://github.com/llvm/llvm-project/pull/76405.diff
1 Files Affected:
- (modified) llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp (+3)
``````````diff
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
index a4487e2dc21be1..208e3ac2c55343 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
@@ -157,6 +157,9 @@ bool DWARFUnitIndex::parseImpl(DataExtractor IndexData) {
auto Index = IndexData.getU32(&Offset);
if (!Index)
continue;
+ // Ensure Index is in valid range
+ if (Index > Header.NumColumns)
+ return false;
Rows[i].Index = this;
Rows[i].Contributions =
std::make_unique<Entry::SectionContribution[]>(Header.NumColumns);
``````````
</details>
https://github.com/llvm/llvm-project/pull/76405
More information about the llvm-commits
mailing list