Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2024 16:49:12 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: efaa4bcc9283 - stable/14 - sound: Add min_rate and min_channels safety check in SNDCTL_AUDIOINFO
Message-ID:  <202407101649.46AGnC3r035220@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=efaa4bcc92835cd4208717d518cacd0aa6f8b1dd

commit efaa4bcc92835cd4208717d518cacd0aa6f8b1dd
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-07-06 18:23:15 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-07-10 16:48:13 +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
    
    (cherry picked from commit 1a768ea9db3d66941b0dc5340ac028ef548808b8)
---
 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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407101649.46AGnC3r035220>