skiptags: only check the extra footer size for APEv2

APEv1 should have flags set to 0 (no footer), but let's not assume writers set
this properly.

https://mutagen-specs.readthedocs.io/en/latest/apev2/apev2.html
This commit is contained in:
Steve Lhomme 2022-04-05 10:34:45 +02:00
parent 4c06a11cf9
commit 225e0c1ee6
1 changed files with 11 additions and 8 deletions

View File

@ -98,15 +98,18 @@ static uint_fast32_t SkipAPETag(stream_t *s)
uint_fast32_t size = GetDWLE(peek + 12);
uint_fast32_t flags = GetDWLE(peek + 16);
if ((flags & (1u << 29)) == 0)
return 0;
if (flags & (1u << 30))
if (version >= 2000)
{
if (size > UINT32_MAX - 32u)
return 0; /* impossibly long tag */
size += 32;
uint_fast32_t flags = GetDWLE(peek + 16);
if ((flags & (1u << 29)) == 0)
return 0;
if (flags & (1u << 30))
{
if (size > UINT32_MAX - 32u)
return 0; /* impossibly long tag */
size += 32;
}
}
msg_Dbg(s, "AP2 v%"PRIuFAST32" tag found, "