[PATCH] D138986: [AIX][BigArchive] Treat the archive is empty if the first child member offset is zero

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 23:34:13 PST 2022


lkail updated this revision to Diff 482370.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138986

Files:
  llvm/include/llvm/Object/Archive.h
  llvm/test/Object/archive-big-read-empty-with-freelist.test


Index: llvm/test/Object/archive-big-read-empty-with-freelist.test
===================================================================
--- llvm/test/Object/archive-big-read-empty-with-freelist.test
+++ llvm/test/Object/archive-big-read-empty-with-freelist.test
@@ -1,3 +1,3 @@
 # Test reading an empty archive with free list in it.
-# RUN: not llvm-ar tv %p/Inputs/aix-empty-big-archive-with-freelist.a 2>&1 \
-# RUN:   | grep 'truncated or malformed archive'
+# RUN: llvm-ar tv %p/Inputs/aix-empty-big-archive-with-freelist.a 2>&1 \
+# RUN:   | not grep 'truncated or malformed archive'
Index: llvm/include/llvm/Object/Archive.h
===================================================================
--- llvm/include/llvm/Object/Archive.h
+++ llvm/include/llvm/Object/Archive.h
@@ -413,9 +413,7 @@
   BigArchive(MemoryBufferRef Source, Error &Err);
   uint64_t getFirstChildOffset() const override { return FirstChildOffset; }
   uint64_t getLastChildOffset() const { return LastChildOffset; }
-  bool isEmpty() const override {
-    return Data.getBufferSize() == sizeof(FixLenHdr);
-  };
+  bool isEmpty() const override { return getFirstChildOffset() == 0; }
 };
 
 } // end namespace object


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138986.482370.patch
Type: text/x-patch
Size: 1192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221213/613494cf/attachment.bin>


More information about the llvm-commits mailing list