decoder/opus: move comment size check to ScanOneOpusTag()
Prepare for parsing large binary comments (such as METADATA_BLOCK_PICTURE).
This commit is contained in:
@@ -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,
|
|||||||
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;
|
||||||
|
Reference in New Issue
Block a user