Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Bounds checking inside the mixing of the audio block.



details:   https://anonhg.NetBSD.org/src/rev/86af7501075f
branches:  trunk
changeset: 823722:86af7501075f
user:      nat <nat%NetBSD.org@localhost>
date:      Fri May 05 00:38:50 2017 +0000

description:
Bounds checking inside the mixing of the audio block.

Addresses PR kern/52175.

diffstat:

 sys/dev/audio.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (37 lines):

diff -r 761e85e11454 -r 86af7501075f sys/dev/audio.c
--- a/sys/dev/audio.c   Thu May 04 19:12:53 2017 +0000
+++ b/sys/dev/audio.c   Fri May 05 00:38:50 2017 +0000
@@ -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 <nathanialsloss%yahoo.com.au@localhost>
@@ -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,13 +5571,13 @@
                                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;                                    \
                }                                                       \
        }                                                               \



Home | Main Index | Thread Index | Old Index