Module Name:    src
Committed By:   nat
Date:           Fri May  5 00:38:50 UTC 2017

Modified Files:
        src/sys/dev: audio.c

Log Message:
Bounds checking inside the mixing of the audio block.

Addresses PR kern/52175.


To generate a diff of this commit:
cvs rdiff -u -r1.332 -r1.333 src/sys/dev/audio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.332 src/sys/dev/audio.c:1.333
--- src/sys/dev/audio.c:1.332	Tue May  2 07:25:50 2017
+++ src/sys/dev/audio.c	Fri May  5 00:38:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.332 2017/05/02 07:25:50 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.333 2017/05/05 00:38:50 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.332 2017/05/02 07:25:50 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.333 2017/05/05 00:38:50 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -5571,12 +5571,12 @@ mix_write(void *arg)
 				else if (orig[m] < 0 && tomix[m] < 0)	\
 					result -= product / MINVAL;	\
 				orig[m] = result;			\
-			}						\
 									\
-			if (&orig[m] >= (type *)sc->sc_pr.s.end)	\
-				orig = (type *)sc->sc_pr.s.start;	\
-			if (&tomix[m] >= (type *)cb->s.end)		\
-				tomix = (type *)cb->s.start;		\
+				if (&orig[m] >= (type *)sc->sc_pr.s.end)\
+					orig = (type *)sc->sc_pr.s.start;\
+				if (&tomix[m] >= (type *)cb->s.end)	\
+					tomix = (type *)cb->s.start;	\
+			}						\
 									\
 			resid -= cc;					\
 		}							\

Reply via email to