decoder/DsdLib: make variables more local
This commit is contained in:
parent
67093a5143
commit
7087fdf6c0
@ -115,29 +115,23 @@ dsdlib_tag_id3(InputStream &is,
|
|||||||
if (!dsdlib_skip_to(nullptr, is, tagoffset))
|
if (!dsdlib_skip_to(nullptr, is, tagoffset))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
struct id3_tag *id3_tag = nullptr;
|
|
||||||
id3_length_t count;
|
|
||||||
|
|
||||||
/* Prevent broken files causing problems */
|
/* Prevent broken files causing problems */
|
||||||
const auto size = is.GetSize();
|
const auto size = is.GetSize();
|
||||||
const auto offset = is.GetOffset();
|
const auto offset = is.GetOffset();
|
||||||
if (offset >= size)
|
if (offset >= size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
count = size - offset;
|
const id3_length_t count = size - offset;
|
||||||
|
|
||||||
/* Check and limit id3 tag size to prevent a stack overflow */
|
/* Check and limit id3 tag size to prevent a stack overflow */
|
||||||
id3_byte_t dsdid3[4096];
|
id3_byte_t dsdid3[4096];
|
||||||
if (count == 0 || count > sizeof(dsdid3))
|
if (count == 0 || count > sizeof(dsdid3))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
id3_byte_t *dsdid3data;
|
if (!decoder_read_full(nullptr, is, dsdid3, count))
|
||||||
dsdid3data = dsdid3;
|
|
||||||
|
|
||||||
if (!decoder_read_full(nullptr, is, dsdid3data, count))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
id3_tag = id3_tag_parse(dsdid3data, count);
|
struct id3_tag *id3_tag = id3_tag_parse(dsdid3, count);
|
||||||
if (id3_tag == nullptr)
|
if (id3_tag == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user