git: 1a768ea9db3d - main - sound: Add min_rate and min_channels safety check in SNDCTL_AUDIOINFO
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 06 Jul 2024 18:24:19 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=1a768ea9db3d66941b0dc5340ac028ef548808b8
commit 1a768ea9db3d66941b0dc5340ac028ef548808b8
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-07-06 18:23:15 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-07-06 18:23:15 +0000
sound: Add min_rate and min_channels safety check in SNDCTL_AUDIOINFO
If the channel list is empty, min_rate and min_channels will be INT_MAX.
Instead, assign them to 0, like we do in sndstat_get_caps().
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D45876
---
sys/dev/sound/pcm/dsp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 0689dfedb9c2..2b765bc8b115 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -2182,6 +2182,10 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai, bool ex)
CHN_UNLOCK(ch);
}
+ if (ai->min_rate == INT_MAX)
+ ai->min_rate = 0;
+ if (ai->min_channels == INT_MAX)
+ ai->min_channels = 0;
PCM_UNLOCK(d);