Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150464007
D55403.id172379.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
840 B
Referenced Files
None
Subscribers
None
D55403.id172379.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D55403: sound: Detect unsupported formats
Attached
Detach File
Event Timeline
Log In to Comment