diff options
author | Max Kellermann <max@duempel.org> | 2015-01-30 23:22:49 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-01-30 23:22:49 +0100 |
commit | e2e66404d5fa8f3fcc0581abdf6d2ccc9790954e (patch) | |
tree | 7f0cc291cdc79b8ec82304c718a6ac36c0e511f4 /src/decoder | |
parent | 3ecb19d0f15fb5d32d21af7e79bd6528f97c6956 (diff) | |
download | mpd-e2e66404d5fa8f3fcc0581abdf6d2ccc9790954e.tar.gz mpd-e2e66404d5fa8f3fcc0581abdf6d2ccc9790954e.tar.xz mpd-e2e66404d5fa8f3fcc0581abdf6d2ccc9790954e.zip |
decoder/DsdLib: fix integer overflow in ID3 size calculation
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/plugins/DsdLib.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/decoder/plugins/DsdLib.cxx b/src/decoder/plugins/DsdLib.cxx index de1ce0655..11500b654 100644 --- a/src/decoder/plugins/DsdLib.cxx +++ b/src/decoder/plugins/DsdLib.cxx @@ -117,13 +117,15 @@ dsdlib_tag_id3(InputStream &is, if (tagoffset >= size) return; - const id3_length_t count = size - tagoffset; - if (count < 10 || count > 1024 * 1024) + const auto count64 = size - tagoffset; + if (count64 < 10 || count64 > 1024 * 1024) return; if (!dsdlib_skip_to(nullptr, is, tagoffset)) return; + const id3_length_t count = count64; + id3_byte_t *const id3_buf = new id3_byte_t[count]; if (id3_buf == nullptr) return; |