Commit 3ecb19d0 authored by Max Kellermann's avatar Max Kellermann

decoder/DsdLib: check size before seeking

parent fd02c87f
...@@ -112,19 +112,18 @@ dsdlib_tag_id3(InputStream &is, ...@@ -112,19 +112,18 @@ dsdlib_tag_id3(InputStream &is,
if (tagoffset == 0 || !is.KnownSize()) if (tagoffset == 0 || !is.KnownSize())
return; return;
if (!dsdlib_skip_to(nullptr, is, tagoffset))
return;
/* Prevent broken files causing problems */ /* Prevent broken files causing problems */
const auto size = is.GetSize(); const auto size = is.GetSize();
if (tagoffset >= size) if (tagoffset >= size)
return; return;
const id3_length_t count = size - tagoffset; const id3_length_t count = size - tagoffset;
if (count < 10 || count > 1024 * 1024) if (count < 10 || count > 1024 * 1024)
return; return;
if (!dsdlib_skip_to(nullptr, is, tagoffset))
return;
id3_byte_t *const id3_buf = new id3_byte_t[count]; id3_byte_t *const id3_buf = new id3_byte_t[count];
if (id3_buf == nullptr) if (id3_buf == nullptr)
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment