Page MenuHomeFreeBSD

D55403.id172379.diff
No OneTemporary

D55403.id172379.diff

diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -2092,9 +2092,23 @@
int
chn_setformat(struct pcm_channel *c, uint32_t format)
{
- uint32_t oldformat, oldspeed;
+ uint32_t oldformat, oldspeed, x;
int ret;
+ /*
+ * Detect unsupported formats. This checks if the format is supported
+ * in the first place, and that no more than 1 format is specified at
+ * the same time.
+ */
+ x = format & AFMT_CONVERTIBLE;
+ if ((x & (x - 1)) != 0) {
+ if (snd_verbose > 3) {
+ device_printf(c->dev, "%s(): Unsupported format: "
+ "0x%08x\n", __func__, format);
+ }
+ return (EINVAL);
+ }
+
/* XXX force stereo */
if ((format & AFMT_PASSTHROUGH) && AFMT_CHANNEL(format) < 2) {
format = SND_FORMAT(format, AFMT_PASSTHROUGH_CHANNEL,

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 2, 10:48 AM (8 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28925608
Default Alt Text
D55403.id172379.diff (840 B)

Event Timeline