Skip to content

dr_wav: Fix signed integer overflow in MSADPCM decoder - #335

Open
timblechmann wants to merge 1 commit into
mackron:masterfrom
timblechmann:fixes/msadpcm-integer-overflow
Open

dr_wav: Fix signed integer overflow in MSADPCM decoder#335
timblechmann wants to merge 1 commit into
mackron:masterfrom
timblechmann:fixes/msadpcm-integer-overflow

Conversation

@timblechmann

Copy link
Copy Markdown
Contributor

nibble * delta in drwav_read_pcm_frames_s16__msadpcm can overflow drwav_int32 (nibble ±8, delta up to 0x7FFFFFFF), as can the sum with the coefficient prediction. Found by UBSan/ClusterFuzz.

Add drwav__msadpcm_calc_sample() that computes the full sample in int64 and clamps the final result to [-32768, 32767].

minimized reproducer: clusterfuzz-testcase-minimized-dr_wav_fuzzer-4682179674963968.tar.gz

nibble * delta in drwav_read_pcm_frames_s16__msadpcm can overflow
drwav_int32 (nibble ±8, delta up to 0x7FFFFFFF), as can the sum
with the coefficient prediction. Found by UBSan/ClusterFuzz.

Add drwav__msadpcm_calc_sample() that computes the full sample in
int64 and clamps the final result to [-32768, 32767].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant