summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2010-02-15 17:42:11 -0800
committerKeith Packard <keithp@keithp.com>2010-02-17 23:15:34 -0800
commitbe96fb2f02c13a6ee8aba40f7d4c3f9141f06cea (patch)
tree193006be2eb37a8229b0541d5e8dc83fcdd34fd4
parent2d40f22d1ec970a84b23aa42b1feca4feedeb4bb (diff)
Solaris xf86OSRingBell() off-by-one error in filling iov[] array
When generating sound buffers for /dev/audio bells, insert waveform for beep *or* silence, but not both, so we don't write one entry past the end of the iov buffer when the final bit of soundwave ends up in the final entry allocated in the iov array. Fixes OpenSolaris bug 6894890: http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6894890 Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--hw/xfree86/os-support/solaris/sun_bell.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/xfree86/os-support/solaris/sun_bell.c b/hw/xfree86/os-support/solaris/sun_bell.c
index 7f146eaaf..05d17492a 100644
--- a/hw/xfree86/os-support/solaris/sun_bell.c
+++ b/hw/xfree86/os-support/solaris/sun_bell.c
@@ -126,14 +126,15 @@ xf86OSRingBell(int loudness, int pitch, int duration)
iovcnt = 0;
for (cnt = 0; cnt <= repeats; cnt++) {
- iov[iovcnt].iov_base = (char *) samples;
- iov[iovcnt++].iov_len = sizeof(samples);
if (cnt == repeats) {
/* Insert a bit of silence so that multiple beeps are distinct and
* not compressed into a single tone.
*/
iov[iovcnt].iov_base = (char *) silence;
iov[iovcnt++].iov_len = sizeof(silence);
+ } else {
+ iov[iovcnt].iov_base = (char *) samples;
+ iov[iovcnt++].iov_len = sizeof(samples);
}
if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
written = writev(audioFD, iov, iovcnt);