[PATCH] D100651: [AIX] Support of Big archive (read)
Esme Yi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 7 23:18:54 PDT 2021
Esme added inline comments.
================
Comment at: llvm/lib/Object/Archive.cpp:1013
+ return child_end();
+ const char *Loc = Data.getBufferStart() + strlen(Magic) + sizeof(Archive::ArFixLenHdrType);
+ Child C(this, Loc, &Err);
----------------
It's not correct to calculate the offset of the first archive member by `Data.getBufferStart() + strlen(Magic) + sizeof(Archive::ArFixLenHdrType);`, please use the value of `ArFixLenHdr->FirstArOffset`.
You can easily reproduce the bug if you test a archive file which contains a object file member like the comment I added before:
```
$ xlc 1.c -o 1.o
$ ar -v -q 1.a 1.o
$ llvm-ar tv 1.a
llvm-ar: error: unable to load '1.a': truncated or malformed archive (characters in size field in archive header are not all decimal numbers: '\000\000\000\000\000\000\000\000\000\0005892' for archive member header at offset 128)
```
The correct offset for this case should be 138 instead of 128.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100651/new/
https://reviews.llvm.org/D100651
More information about the llvm-commits
mailing list