aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-30 23:19:26 +0100
committerMax Kellermann <max@duempel.org>2015-01-30 23:19:26 +0100
commit3ecb19d0f15fb5d32d21af7e79bd6528f97c6956 (patch)
treef84a584acc4c3ccb431fd182a91cea81987b4165
parentfd02c87fa2186c1151a2f5ff41115d83b5aedb63 (diff)
downloadmpd-3ecb19d0f15fb5d32d21af7e79bd6528f97c6956.tar.gz
mpd-3ecb19d0f15fb5d32d21af7e79bd6528f97c6956.tar.xz
mpd-3ecb19d0f15fb5d32d21af7e79bd6528f97c6956.zip
decoder/DsdLib: check size before seeking
-rw-r--r--src/decoder/plugins/DsdLib.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/decoder/plugins/DsdLib.cxx b/src/decoder/plugins/DsdLib.cxx
index 664bf60ce..de1ce0655 100644
--- a/src/decoder/plugins/DsdLib.cxx
+++ b/src/decoder/plugins/DsdLib.cxx
@@ -112,19 +112,18 @@ dsdlib_tag_id3(InputStream &is,
if (tagoffset == 0 || !is.KnownSize())
return;
- if (!dsdlib_skip_to(nullptr, is, tagoffset))
- return;
-
/* Prevent broken files causing problems */
const auto size = is.GetSize();
if (tagoffset >= size)
return;
const id3_length_t count = size - tagoffset;
-
if (count < 10 || count > 1024 * 1024)
return;
+ if (!dsdlib_skip_to(nullptr, is, tagoffset))
+ return;
+
id3_byte_t *const id3_buf = new id3_byte_t[count];
if (id3_buf == nullptr)
return;