decoder/opus: move comment size check to ScanOneOpusTag()

Prepare for parsing large binary comments (such as
METADATA_BLOCK_PICTURE).
This commit is contained in:
Max Kellermann 2019-08-13 12:19:31 +02:00
parent e2da13b0d3
commit 6b51429203
1 changed files with 4 additions and 3 deletions

View File

@ -45,6 +45,10 @@ ScanOneOpusTag(StringView name, StringView value,
ReplayGainInfo *rgi,
TagHandler &handler) noexcept
{
if (value.size >= 4096)
/* ignore large values */
return;
if (rgi != nullptr && name.EqualsIgnoreCase("R128_TRACK_GAIN")) {
/* R128_TRACK_GAIN is a Q7.8 fixed point number in
dB */
@ -97,9 +101,6 @@ ScanOpusTags(const void *data, size_t size,
if (s == nullptr)
return false;
if (s.size >= 4096)
continue;
const auto split = s.Split('=');
if (split.first.empty() || split.second.IsNull())
continue;