[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:57:46 PST 2022


lkail added inline comments.


================
Comment at: llvm/include/llvm/Object/Archive.h:416
   uint64_t getLastChildOffset() const { return LastChildOffset; }
-  bool isEmpty() const override {
-    return Data.getBufferSize() == sizeof(FixLenHdr);
-  };
+  bool isEmpty() const override { getFirstChildOffset() == 0; };
 };
----------------
DiggerLin wrote:
> Esme wrote:
> > 
> if we have big  archive file which only has archive Fixed-Length Header and the fl_fstmoff[20] is not zero. I am not sure that the program is crash or print malform at this situation(the program should not crash) ? if (Data.getBufferSize() == sizeof(FixLenHdr) || getFirstChildOffset() == 0) , I am sure that it not crash.  
Tried with following case
```
<bigaf>
0                   0                   0                   128                 0                   0                   
```
`llvm-ar tv` exits silently without this patch. While `ar tv` prints
```
ar: 0707-123 The archive file libbar.a is corrupted.  
        The member table is missing.
        The command 'ar -o libbar.a' may restore the member table.
```
I added a test case for it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138986



More information about the llvm-commits mailing list