Subject: kern/1770: Setting /dev/audio's sample rate too low causes kernel to divide by zero
To: None <gnats-bugs@gnats.netbsd.org>
From: None <khym@bga.com>
List: netbsd-bugs
Date: 11/16/1995 19:40:07
>Number: 1770
>Category: kern
>Synopsis: Setting /dev/audio's sample rate too low causes kernel to divide by zero
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 16 21:05:08 1995
>Last-Modified:
>Originator: David Huang
>Organization:
Name: Dave Huang | Mammal, mammal / their names are called /
INet: khym@bga.com | they raise a paw / the bat, the cat /
FurryMUCK: Dahan | dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 19 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++
>Release: NetBSD-current as of Nov 14, 1995
>Environment:
System: NetBSD spiff.bga.com 1.1_ALPHA NetBSD 1.1_ALPHA (SPIFF) #18: Wed Nov 15 23:31:21 CST 1995 khym@spiff.bga.com:/usr/src/sys/arch/i386/compile/SPIFF i386
>Description:
Setting /dev/audio's playback sample rate (via the AUDIO_SETINFO
ioctl) to less than 100 samples/sec causes a divide by zero in
audio_initbufs.
>How-To-Repeat:
Try it.
>Fix:
I don't know if this is the correct fix, but it works for me! :)
*** sys/dev/audio.c.orig Wed Nov 15 21:37:42 1995
--- sys/dev/audio.c Wed Nov 15 21:37:43 1995
***************
*** 818,823 ****
--- 818,826 ----
if (bs > AU_RING_SIZE)
bs = AU_RING_SIZE;
+ if (bs < 2)
+ bs = 2;
+
bs &= ~1; /* make it even, in case of stereo */
return(bs);
}
>Audit-Trail:
>Unformatted: