[llvm] [llvm] Validate Parent object before dereference (PR #157460)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 8 06:28:59 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-binary-utilities
Author: Daniel Kuts (apach301)
<details>
<summary>Changes</summary>
Fixes #<!-- -->157449
---
Full diff: https://github.com/llvm/llvm-project/pull/157460.diff
1 Files Affected:
- (modified) llvm/lib/Object/Archive.cpp (+3-2)
``````````diff
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index 92f31c909efd4..c3111ebe0f525 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -472,10 +472,11 @@ Archive::Child::Child(const Archive *Parent, const char *Start, Error *Err)
return;
}
+ assert(Parent && "Parent can't be nullptr if Start is not a nullptr");
+
Header = Parent->createArchiveMemberHeader(
Start,
- Parent ? Parent->getData().size() - (Start - Parent->getData().data())
- : 0,
+ Parent->getData().size() - (Start - Parent->getData().data()),
Err);
// If we are pointed to real data, Start is not a nullptr, then there must be
``````````
</details>
https://github.com/llvm/llvm-project/pull/157460
More information about the llvm-commits
mailing list