mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:32:45 +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:
		
							parent
							
								
									efc6060df0
								
							
						
					
					
						commit
						00f1cb924b
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		|  | @ -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; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Idan Horowitz
						Idan Horowitz