mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 15:00:11 +01:00
cleanup: fix leaks/overread
This commit is contained in:
parent
1ed15ed25a
commit
0afb67b5a7
@ -219,7 +219,9 @@ static unsigned int bitreader_peek(clData* br, int bitsize) {
|
|||||||
unsigned int v = 0;
|
unsigned int v = 0;
|
||||||
unsigned int bit_offset, bit_left;
|
unsigned int bit_offset, bit_left;
|
||||||
|
|
||||||
if (!(bit + bitsize <= size))
|
if (bit + bitsize > size)
|
||||||
|
return v;
|
||||||
|
if (bitsize == 0) /* may happen when resolution is 0 (dequantize_coefficients) */
|
||||||
return v;
|
return v;
|
||||||
|
|
||||||
bit_offset = bitsize + bit_rem;
|
bit_offset = bitsize + bit_rem;
|
||||||
|
@ -1055,8 +1055,11 @@ static int preload_acb_cuename(acb_header* acb) {
|
|||||||
|
|
||||||
if (*p_rows)
|
if (*p_rows)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!open_utf_subtable(acb, &acb->CueNameSf, &Table, "CueNameTable", p_rows, ACB_TABLE_BUFFER_CUENAME))
|
if (!open_utf_subtable(acb, &acb->CueNameSf, &Table, "CueNameTable", p_rows, ACB_TABLE_BUFFER_CUENAME))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
acb->CueNames = Table; /* keep this table around since we need CueName pointers */
|
||||||
|
|
||||||
if (!*p_rows)
|
if (!*p_rows)
|
||||||
return 1;
|
return 1;
|
||||||
//;VGM_LOG("acb: preload CueName=%i\n", *p_rows);
|
//;VGM_LOG("acb: preload CueName=%i\n", *p_rows);
|
||||||
@ -1074,7 +1077,7 @@ static int preload_acb_cuename(acb_header* acb) {
|
|||||||
utf_query_col_string(Table, i, c_CueName, &r->CueName);
|
utf_query_col_string(Table, i, c_CueName, &r->CueName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//utf_close(Table); /* keep this table around since we need CueName pointers */
|
//utf_close(Table); /* released at the end */
|
||||||
return 1;
|
return 1;
|
||||||
fail:
|
fail:
|
||||||
VGM_LOG("acb: failed CueName preload\n");
|
VGM_LOG("acb: failed CueName preload\n");
|
||||||
@ -1245,6 +1248,7 @@ void load_acb_wave_info(STREAMFILE* sf, VGMSTREAM* vgmstream, int waveid, int po
|
|||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
fail:
|
fail:
|
||||||
|
VGM_LOG("close %x\n", (uint32_t)acb.CueNames);
|
||||||
utf_close(acb.Header);
|
utf_close(acb.Header);
|
||||||
utf_close(acb.CueNames);
|
utf_close(acb.CueNames);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user