Skip to content

Commit

Permalink
Merge pull request #1120 from daxtens/fixes2
Browse files Browse the repository at this point in the history
Fix a 7zip crash and a ISO9660 infinite loop
  • Loading branch information
mmatuska committed Jan 20, 2019
2 parents 116491b + 65a23f5 commit 45e6d54
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 1 addition & 7 deletions libarchive/archive_read_support_format_7zip.c
Expand Up @@ -2964,13 +2964,7 @@ get_uncompressed_data(struct archive_read *a, const void **buff, size_t size,
if (zip->codec == _7Z_COPY && zip->codec2 == (unsigned long)-1) {
/* Copy mode. */

/*
* Note: '1' here is a performance optimization.
* Recall that the decompression layer returns a count of
* available bytes; asking for more than that forces the
* decompressor to combine reads by copying data.
*/
*buff = __archive_read_ahead(a, 1, &bytes_avail);
*buff = __archive_read_ahead(a, minimum, &bytes_avail);
if (bytes_avail <= 0) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_FILE_FORMAT,
Expand Down
11 changes: 10 additions & 1 deletion libarchive/archive_read_support_format_iso9660.c
Expand Up @@ -2102,6 +2102,7 @@ parse_rockridge(struct archive_read *a, struct file_info *file,
const unsigned char *p, const unsigned char *end)
{
struct iso9660 *iso9660;
int entry_seen = 0;

iso9660 = (struct iso9660 *)(a->format->data);

Expand Down Expand Up @@ -2257,8 +2258,16 @@ parse_rockridge(struct archive_read *a, struct file_info *file,
}

p += p[2];
entry_seen = 1;
}

if (entry_seen)
return (ARCHIVE_OK);
else {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Tried to parse Rockridge extensions, but none found");
return (ARCHIVE_WARN);
}
return (ARCHIVE_OK);
}

static int
Expand Down

0 comments on commit 45e6d54

Please sign in to comment.