Commit 6b514292 authored by Max Kellermann's avatar Max Kellermann

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

Prepare for parsing large binary comments (such as METADATA_BLOCK_PICTURE).
parent e2da13b0
...@@ -45,6 +45,10 @@ ScanOneOpusTag(StringView name, StringView value, ...@@ -45,6 +45,10 @@ ScanOneOpusTag(StringView name, StringView value,
ReplayGainInfo *rgi, ReplayGainInfo *rgi,
TagHandler &handler) noexcept TagHandler &handler) noexcept
{ {
if (value.size >= 4096)
/* ignore large values */
return;
if (rgi != nullptr && name.EqualsIgnoreCase("R128_TRACK_GAIN")) { if (rgi != nullptr && name.EqualsIgnoreCase("R128_TRACK_GAIN")) {
/* R128_TRACK_GAIN is a Q7.8 fixed point number in /* R128_TRACK_GAIN is a Q7.8 fixed point number in
dB */ dB */
...@@ -97,9 +101,6 @@ ScanOpusTags(const void *data, size_t size, ...@@ -97,9 +101,6 @@ ScanOpusTags(const void *data, size_t size,
if (s == nullptr) if (s == nullptr)
return false; return false;
if (s.size >= 4096)
continue;
const auto split = s.Split('='); const auto split = s.Split('=');
if (split.first.empty() || split.second.IsNull()) if (split.first.empty() || split.second.IsNull())
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment