ref: 8eef69ee71be395e0a2327501059986d782fc348
parent: f07984fc62846eb61f12b3c01a86e31f8a71f2d8
author: lieff <[email protected]>
date: Thu Feb 27 22:25:17 EST 2020
mp3dec_ex: skip full apetag + test
--- a/minimp3_ex.h
+++ b/minimp3_ex.h
@@ -118,10 +118,10 @@
{
size_t buf_size = *pbuf_size;
#ifndef MINIMP3_NOSKIP_ID3V1
- if (buf_size > 128 && !memcmp(buf + buf_size - 128, "TAG", 3))
+ if (buf_size >= 128 && !memcmp(buf + buf_size - 128, "TAG", 3))
{
buf_size -= 128;
- if (buf_size > 227 && !memcmp(buf + buf_size - 227, "TAG+", 4))
+ if (buf_size >= 227 && !memcmp(buf + buf_size - 227, "TAG+", 4))
buf_size -= 227;
}
#endif
@@ -129,6 +129,10 @@
if (buf_size > 32 && !memcmp(buf + buf_size - 32, "APETAGEX", 8))
{
buf_size -= 32;
+ const uint8_t *tag = buf + buf_size + 8 + 4;
+ uint32_t tag_size = (uint32_t)(tag[3] << 24) | (tag[2] << 16) | (tag[1] << 8) | tag[0];
+ if (buf_size >= tag_size)
+ buf_size -= tag_size;
}
#endif
*pbuf_size = buf_size;
binary files /dev/null b/vectors/l3-nonstandard-apetag.bit differ
binary files /dev/null b/vectors/l3-nonstandard-apetag.pcm differ