Skip to content
Permalink
Browse files Browse the repository at this point in the history
Issue 717: Fix integer overflow when computing location of volume des…
…criptor

The multiplication here defaulted to 'int' but calculations
of file positions should always use int64_t.  A simple cast
suffices to fix this since the base location is always 32 bits
for ISO, so multiplying by the sector size will never overflow
a 64-bit integer.
  • Loading branch information
kientzle committed Jun 19, 2016
1 parent 05caadc commit 3ad08e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libarchive/archive_read_support_format_iso9660.c
Expand Up @@ -1091,7 +1091,7 @@ choose_volume(struct archive_read *a, struct iso9660 *iso9660)
/* This condition is unlikely; by way of caution. */
vd = &(iso9660->joliet);

skipsize = LOGICAL_BLOCK_SIZE * vd->location;
skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location;
skipsize = __archive_read_consume(a, skipsize);
if (skipsize < 0)
return ((int)skipsize);
Expand Down Expand Up @@ -1129,7 +1129,7 @@ choose_volume(struct archive_read *a, struct iso9660 *iso9660)
&& iso9660->seenJoliet) {
/* Switch reading data from primary to joliet. */
vd = &(iso9660->joliet);
skipsize = LOGICAL_BLOCK_SIZE * vd->location;
skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location;
skipsize -= iso9660->current_position;
skipsize = __archive_read_consume(a, skipsize);
if (skipsize < 0)
Expand Down

0 comments on commit 3ad08e0

Please sign in to comment.