1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
Description: xa: validate channel count
A corrupt header specifying zero channels would send read_channels()
into an infinite loop. Prevent this by sanity checking the channel
count in open_read(). Also add an upper bound to prevent overflow
in multiplication.
Author: Mans Rullgard <mans@mansr.com>
Origin: upstream, https://github.com/mansr/sox/commit/7a8ceb86212b28243bbb6d0de636f0dfbe833e53
--- a/src/xa.c 2012-01-23 23:27:33.000000000 +0100
+++ b/src/xa.c 2019-02-28 10:32:46.220409795 +0100
@@ -143,6 +143,12 @@
lsx_report("User options overriding rate read in .xa header");
}
+ if (ft->signal.channels == 0 || ft->signal.channels > UINT16_MAX) {
+ lsx_fail_errno(ft, SOX_EFMT, "invalid channel count %d",
+ ft->signal.channels);
+ return SOX_EOF;
+ }
+
/* Check for supported formats */
if (ft->encoding.bits_per_sample != 16) {
lsx_fail_errno(ft, SOX_EFMT, "%d-bit sample resolution not supported.",
|