[llvm] [llvm] Validate Parent object before dereference (PR #157460)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 03:04:43 PDT 2025


================
@@ -472,10 +472,10 @@ 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");
----------------
jh7370 wrote:

I'm not really sure what you're asking. `Parent` has to be non-null, because otherwise `createArchiveMemberHeader` couldn't be called.

(For the record, I went over all the call sites I could find and `Parent` is only null, if `Start` is null).

https://github.com/llvm/llvm-project/pull/157460


More information about the llvm-commits mailing list