[PATCH] D38149: Fix off-by-one error in TarWriter.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 16:05:19 PDT 2017


zturner added a comment.

Can you add the following tests?

  std::string(154, 'x') + "/" + std::string(100, 'y');
  std::string(150, 'x') + "/" + std::string(20, 'y') + "/" + std::string(20, 'z');

Can you also add a test that if we can't use a Ustar header, that we can still produce a valid Tar file by using a Pax header?



================
Comment at: llvm/lib/Support/TarWriter.cpp:128
+// Otherwise, returns false.
+static bool splitUstar(StringRef Path, StringRef *Prefix, StringRef *Name) {
+  if (Path.size() < sizeof(UstarHeader::Name)) {
----------------
Might as well make them `StringRef&` instead.


https://reviews.llvm.org/D38149





More information about the llvm-commits mailing list