mirror of
https://github.com/libretro/RetroArch
synced 2025-02-26 15:39:55 +00:00
Prevent crash with zipped roms
This commit is contained in:
parent
258bd96383
commit
88e88e92f3
@ -355,7 +355,10 @@ end:
|
||||
if (handle)
|
||||
{
|
||||
if (handle->backend)
|
||||
handle->backend->stream_free(handle->stream);
|
||||
{
|
||||
if (handle->backend->stream_free)
|
||||
handle->backend->stream_free(handle->stream);
|
||||
}
|
||||
|
||||
if (handle->data)
|
||||
free(handle->data);
|
||||
@ -427,7 +430,8 @@ int file_archive_parse_file_iterate(
|
||||
}
|
||||
if (state->stream && state->backend)
|
||||
{
|
||||
state->backend->stream_free(state->stream);
|
||||
if (state->backend->stream_free)
|
||||
state->backend->stream_free(state->stream);
|
||||
|
||||
if (state->stream)
|
||||
free(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,
|
||||
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];
|
||||
int ret;
|
||||
const uint8_t *cdata = NULL;
|
||||
uint32_t checksum = 0;
|
||||
uint32_t size = 0;
|
||||
uint32_t csize = 0;
|
||||
unsigned cmode = 0;
|
||||
unsigned payload = 0;
|
||||
|
||||
filename[0] = '\0';
|
||||
|
||||
ret = zip_parse_file_iterate_step_internal(state, filename,
|
||||
&cdata, &cmode, &size, &csize,
|
||||
&checksum, &payload);
|
||||
char filename[PATH_MAX_LENGTH] = {0};
|
||||
const uint8_t *cdata = NULL;
|
||||
uint32_t checksum = 0;
|
||||
uint32_t size = 0;
|
||||
uint32_t csize = 0;
|
||||
unsigned cmode = 0;
|
||||
unsigned payload = 0;
|
||||
int ret = zip_parse_file_iterate_step_internal(
|
||||
state, filename, &cdata, &cmode, &size, &csize, &checksum, &payload);
|
||||
|
||||
if (ret != 1)
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user