1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:18:11 +00:00

LibAudio: decrease WavLoader's size limit to a more reasonable size

A 4 GiB wav (current size limit) is very unreasonable, and larger
than oss-fuzz's 2.5 GiB per-process memory limit.
This commit is contained in:
Idan Horowitz 2021-03-16 19:05:59 +02:00 committed by Andreas Kling
parent efc6060df0
commit 00f1cb924b

View file

@ -34,6 +34,8 @@
namespace Audio {
static constexpr size_t maximum_wav_size = 1 * GiB; // FIXME: is there a more appropriate size limit?
WavLoaderPlugin::WavLoaderPlugin(const StringView& path)
: m_file(Core::File::construct(path))
{
@ -243,7 +245,7 @@ bool WavLoaderPlugin::parse_header()
CHECK_OK("Found no data chunk");
VERIFY(found_data);
ok = ok && data_sz < INT32_MAX;
ok = ok && data_sz < maximum_wav_size;
CHECK_OK("Data was too large");
int bytes_per_sample = (m_bits_per_sample / 8) * m_num_channels;