(file_extract) Fix invalid read in zlib_parse_file_progress()

This commit is contained in:
Higor Eurípedes 2015-12-05 20:57:04 -03:00
parent 3d011e0338
commit f386c9b7f9

View File

@ -606,10 +606,9 @@ bool zlib_parse_file(const char *file, const char *valid_exts,
int zlib_parse_file_progress(void *data)
{
/* FIXME: this estimate is pretty bad */
/* FIXME: this estimate is worse than before */
zlib_transfer_t *state = (zlib_transfer_t*)data;
const uint8_t *offset = state->data + read_le(state->directory + 42, 4);
ptrdiff_t delta = offset - state->data - 46 - 22;
ptrdiff_t delta = state->directory - state->data;
return delta * 100 / state->zip_size;
}