Skip to content

Commit

Permalink
Fix decompress a zip multi-volume archive file without filename exten…
Browse files Browse the repository at this point in the history
…sions will cause an infinite loop.
  • Loading branch information
liuyipingali authored and nmoinvaz committed Oct 23, 2024
1 parent 23bf392 commit 40416c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mz_strm_split.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ static int32_t mz_stream_split_open_disk(void *stream, int32_t number_disk) {
mz_stream_split_print("Split - Goto disk - %s (disk %" PRId32 ")\n", split->path_disk, number_disk);

/* If disk part doesn't exist during reading then return MZ_EXIST_ERROR */
if (disk_part == MZ_OPEN_MODE_READ)
err = mz_os_file_exists(split->path_disk);
if (disk_part == MZ_OPEN_MODE_READ) {
if(strcmp(split->path_disk, split->path_cd) == 0) {
err = MZ_EXIST_ERROR;
} else {
err = mz_os_file_exists(split->path_disk);
}
}

if (err == MZ_OK)
err = mz_stream_open(split->stream.base, split->path_disk, split->mode);
Expand Down Expand Up @@ -241,7 +246,6 @@ int32_t mz_stream_split_read(void *stream, void *buf, int32_t size) {
err = mz_stream_split_goto_disk(stream, split->current_disk + 1);
if (err == MZ_EXIST_ERROR) {
split->current_disk = -1;
break;
}
if (err != MZ_OK)
return err;
Expand Down

0 comments on commit 40416c3

Please sign in to comment.