From: Mike Brady Date: Sat, 16 Jul 2016 13:24:34 +0000 (+0100) Subject: Fix a bug just introduced into the basic stuffing function. X-Git-Tag: 2.8.4.6~4^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F344%2Fhead;p=thirdparty%2Fshairport-sync.git Fix a bug just introduced into the basic stuffing function. --- diff --git a/player.c b/player.c index bcf84118..97eccfb2 100644 --- a/player.c +++ b/player.c @@ -890,7 +890,11 @@ static int stuff_buffer_basic(short *inptr, int length, short *outptr, int stuff } // if you're removing, i.e. stuff < 0, copy that much less over. If you're adding, do all the rest. - for (i = stuffsamp; i < (stuff>0) ? length : length+stuff; i++) { + int remainder = length; + if (stuff<0) + remainder = remainder+stuff; // don't run over the correct end of the output buffer + + for (i = stuffsamp; i < remainder; i++) { *outptr++ = dithered_vol(*inptr++); *outptr++ = dithered_vol(*inptr++); }