From nobody Sat Jul 06 18:24:19 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WGf0z2sQKz5PMPY; Sat, 06 Jul 2024 18:24:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WGf0z1Y1Zz54Jf; Sat, 6 Jul 2024 18:24:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720290259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oWxvXHiLeeE/HJHN+HBsbW2RslG+en2ndnyHHscFqps=; b=RjvhUjpK6jqekTVjiT6cqOlLMz8V5BtJsmnlo5zbPmQWW9CEPv+8HRPdvkj+pm+88mpWGB zjUCi+P6VmBGSdSqRZX/0rwPb+Gyhi8/NXAmF13U0cEqEMO2y/v4hYyJYokN8wQv5aFXIO WRDJOn4KO/Hhge5uxS6qISXeaosCTh/MvDLSykeIFFOlBuiQDLWN0omfBLhz9adetz1SHN tD/nKyDIf47Vp0Z+h2IgnFVD4iciAK5gY8NObgCbcMDDLs8rUN9LrLsS1CmP4mrAneJhKC wWdK5e1GUVQFprFSMNQa9BhGG21LtgB5Nd4GDDc/kggToFHJPKNod6azPNVQBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720290259; a=rsa-sha256; cv=none; b=pEgwcGfgN2O4wK+0JY3TStqO7f83FNjVuh+/o0ShLsQi+Ji4PyDLhFq3Mdsxw2VAG2+Gcr zWeAfMLEgwNQWO3aHUZtjcS07HDP08he/9TrClA+WgO1M58xlvfyI/tXKZ3svN97/4X+Tc hxGz1lHNyxRAWDQwjNVsoAtcinF7B/TguYZdXNiM1K9KbJFzDwxctd79YXmQNX62HzHurn 3rwavLcJaRaRJYnAFOIm7IMY3bhOzBWjX3PaoaSMDrKeAypOjaHThJNH0G4rJdorWf2SEA lXMGkEfjdnEc2oRUPnYSuPZ0RFprjKUhiiarj9wttSScvoSepiaTp7wIlyHUpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720290259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oWxvXHiLeeE/HJHN+HBsbW2RslG+en2ndnyHHscFqps=; b=YcjPfXh4kyKLhH6Hs+Kosi2OkpXPv0HHLY+Rvq+hw7B0uHda5THGf5qMLf27iIXo/IwjM5 oINq/LHk2js6FVIp2I/diDHHhgouP43MTPXIBa+DWPsgTLs/3xFUtQ9Hbl/d8on29TNUei phGr0Yw3gVbZSpybVzaCTSwA+QcGEzSeC7V1mXLxc96kYOFNvUo+iINtdo72b0+rIQ9Agg wsLYezSaBqTMNNv8FAAGz8xyVCtzC2LiyCsPmqjB/TljFauBC0q3iz0zR8def7t56w0o5e wP3Lylv+TEhkgCsCnCdQA4u+UzZthRdvTRz1BjuT3p959ma766ztEdw/qCW/+g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WGf0z16cbzqq0; Sat, 6 Jul 2024 18:24:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 466IOJpm091078; Sat, 6 Jul 2024 18:24:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 466IOJwK091075; Sat, 6 Jul 2024 18:24:19 GMT (envelope-from git) Date: Sat, 6 Jul 2024 18:24:19 GMT Message-Id: <202407061824.466IOJwK091075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 1a768ea9db3d - main - sound: Add min_rate and min_channels safety check in SNDCTL_AUDIOINFO List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a768ea9db3d66941b0dc5340ac028ef548808b8 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=1a768ea9db3d66941b0dc5340ac028ef548808b8 commit 1a768ea9db3d66941b0dc5340ac028ef548808b8 Author: Christos Margiolis AuthorDate: 2024-07-06 18:23:15 +0000 Commit: Christos Margiolis 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);