mirror of
https://gitlab.com/qemu-project/qemu.git
synced 2026-10-28 11:54:41 +08:00
audio/wavcapture: prevent freq overflow and corrupted WAV header
Reject freq <= 0 in wav_start_capture() early, before it is used to compute the WAV header fields. Reported-by: Hui Peng <benquike@gmail.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20261004-issue-4560-v1-12-ccbef537cbeb@redhat.com>
This commit is contained in:
1 parent
b09d2fdb6a
commit
3fefea5d94
1 file changed
+6
@@ -131,6 +131,12 @@ int wav_start_capture(AudioBackend *state, CaptureState *s, const char *path,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (freq <= 0 || freq > 384000) {
|
||||
error_report("invalid frequency %d, must be between 1 and 384000",
|
||||
freq);
|
||||
return -1;
|
||||
}
|
||||
|
||||
stereo = nchannels == 2;
|
||||
bits16 = bits == 16;
|
||||
|
||||
|
||||
Reference in new issue
Block a user