diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-03-16 19:05:59 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-16 18:40:42 +0100 |
commit | 00f1cb924b3b376bc7fb0625063085cc9f86c37c (patch) | |
tree | b7dcb97ce3626d060d0e51ae2e0c0203ef4037d3 /Userland/Libraries/LibAudio/WavLoader.cpp | |
parent | efc6060df08ce05e9e267dc7b7d925930595333c (diff) | |
download | serenity-00f1cb924b3b376bc7fb0625063085cc9f86c37c.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibAudio/WavLoader.cpp')
-rw-r--r-- | Userland/Libraries/LibAudio/WavLoader.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibAudio/WavLoader.cpp b/Userland/Libraries/LibAudio/WavLoader.cpp index 3250e0e2b4..e5e736d430 100644 --- a/Userland/Libraries/LibAudio/WavLoader.cpp +++ b/Userland/Libraries/LibAudio/WavLoader.cpp @@ -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; |