Prevent crash with zipped roms
This commit is contained in:
parent
258bd96383
commit
88e88e92f3
|
@ -355,7 +355,10 @@ end:
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
if (handle->backend)
|
if (handle->backend)
|
||||||
|
{
|
||||||
|
if (handle->backend->stream_free)
|
||||||
handle->backend->stream_free(handle->stream);
|
handle->backend->stream_free(handle->stream);
|
||||||
|
}
|
||||||
|
|
||||||
if (handle->data)
|
if (handle->data)
|
||||||
free(handle->data);
|
free(handle->data);
|
||||||
|
@ -427,6 +430,7 @@ int file_archive_parse_file_iterate(
|
||||||
}
|
}
|
||||||
if (state->stream && state->backend)
|
if (state->stream && state->backend)
|
||||||
{
|
{
|
||||||
|
if (state->backend->stream_free)
|
||||||
state->backend->stream_free(state->stream);
|
state->backend->stream_free(state->stream);
|
||||||
|
|
||||||
if (state->stream)
|
if (state->stream)
|
||||||
|
|
|
@ -432,22 +432,18 @@ static int zip_parse_file_iterate_step_internal(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int zip_parse_file_iterate_step(file_archive_transfer_t *state,
|
static int zip_parse_file_iterate_step(file_archive_transfer_t *state,
|
||||||
const char *valid_exts, struct archive_extract_userdata *userdata, file_archive_file_cb file_cb)
|
const char *valid_exts, struct archive_extract_userdata *userdata,
|
||||||
|
file_archive_file_cb file_cb)
|
||||||
{
|
{
|
||||||
char filename[PATH_MAX_LENGTH];
|
char filename[PATH_MAX_LENGTH] = {0};
|
||||||
int ret;
|
|
||||||
const uint8_t *cdata = NULL;
|
const uint8_t *cdata = NULL;
|
||||||
uint32_t checksum = 0;
|
uint32_t checksum = 0;
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
uint32_t csize = 0;
|
uint32_t csize = 0;
|
||||||
unsigned cmode = 0;
|
unsigned cmode = 0;
|
||||||
unsigned payload = 0;
|
unsigned payload = 0;
|
||||||
|
int ret = zip_parse_file_iterate_step_internal(
|
||||||
filename[0] = '\0';
|
state, filename, &cdata, &cmode, &size, &csize, &checksum, &payload);
|
||||||
|
|
||||||
ret = zip_parse_file_iterate_step_internal(state, filename,
|
|
||||||
&cdata, &cmode, &size, &csize,
|
|
||||||
&checksum, &payload);
|
|
||||||
|
|
||||||
if (ret != 1)
|
if (ret != 1)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue