[PATCH] D135449: [Object] Prevent null pointer dereference in BigArchiveMemberHeader

Victor Campos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 05:15:09 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG56f967db51fb: [Object] Prevent null pointer dereference in BigArchiveMemberHeader (authored by vhscampos).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135449/new/

https://reviews.llvm.org/D135449

Files:
  llvm/lib/Object/Archive.cpp


Index: llvm/lib/Object/Archive.cpp
===================================================================
--- llvm/lib/Object/Archive.cpp
+++ llvm/lib/Object/Archive.cpp
@@ -136,8 +136,11 @@
     return;
   ErrorAsOutParameter ErrAsOutParam(Err);
 
-  if (Size < getSizeOf())
-    *Err = createMemberHeaderParseError(this, RawHeaderPtr, Size);
+  if (Size < getSizeOf()) {
+    Error SubErr = createMemberHeaderParseError(this, RawHeaderPtr, Size);
+    if (Err)
+      *Err = std::move(SubErr);
+  }
 }
 
 // This gets the raw name from the ArMemHdr->Name field and checks that it is


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135449.471501.patch
Type: text/x-patch
Size: 582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221028/d6fa4b0e/attachment.bin>


More information about the llvm-commits mailing list