Package: libarchive13t64
Version: 3.8.10-2
Severity: normal
Tags: upstream
Control: forwarded -1 https://github.com/libarchive/libarchive/issues/3780

Hi,

this is a bug upstream knows about. I'm filing it here so that I can reference
it in the workaround I will upload for genext2fs until this bug is fixed in
libarchive. Reproducer:

--%<-------------------------------------------------------
#include <archive.h>
#include <archive_entry.h>

int main() {
  struct archive_entry *entry;
  struct archive *a;
  int r;
  a = archive_read_new();
  if (a == NULL) {
    fprintf(stderr, "archive_read_new() failed\n");
    return 1;
  }
  if (archive_read_support_format_tar(a) != ARCHIVE_OK) {
    fprintf(stderr, "archive_read_support_format_tar() failed\n");
    return 1;
  }
  if (archive_read_support_format_zip(a) != ARCHIVE_OK) {
    fprintf(stderr, "archive_read_support_format_zip() failed\n");
    return 1;
  }

  r = archive_read_open_FILE(a, stdin);
  if (r) {
    fprintf(stderr, "archive_read_open_FILE() failed\n");
    return 1;
  }
  r = archive_read_next_header(a, &entry);
  if (r == ARCHIVE_EOF) {
    fprintf(stderr, "ARCHIVE_EOF -- success!\n");
    return 0;
  }
  if (r != ARCHIVE_OK) {
    fprintf(stderr, "archive_read_next_header() failed: %s\n",
            archive_error_string(a));
    return 1;
  }
  return 0;
}
-->%-------------------------------------------------------

$ dd if=/dev/zero bs=10240 count=1 status=none | ./a.out
archive_read_next_header() failed: Truncated tar archive detected while reading 
next header

The above will work if archive_read_support_format_zip is commented out, so
in genext2fs I will just limit the input formats to tar to work around this
issue.

More details in the referenced upstream issue.

Thanks!

cheers, josch

Reply via email to