wavpack: Check error codes rather than working around error conditions.
authorAlex Converse <alex.converse@gmail.com>
Thu, 8 Sep 2011 18:02:43 +0000 (11:02 -0700)
committerReinhard Tartler <siretart@tauware.de>
Sat, 24 Dec 2011 11:20:33 +0000 (12:20 +0100)
(cherry picked from commit dba2b63a98bdcac7bda1a8a2c48950518c075e17)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 5d4c065476da547fd1a8a604e3047e1b3a7a29d8)

Conflicts:

libavcodec/wavpack.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/wavpack.c

index 968ffa6..db83c44 100644 (file)
@@ -997,6 +997,9 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
         else
             samplecount = wv_unpack_stereo(s, &s->gb, samples, SAMPLE_FMT_FLT);
 
+        if (samplecount < 0)
+            return -1;
+
     }else{
         if(avctx->sample_fmt == SAMPLE_FMT_S16)
             samplecount = wv_unpack_mono(s, &s->gb, samples, SAMPLE_FMT_S16);
@@ -1005,6 +1008,9 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
         else
             samplecount = wv_unpack_mono(s, &s->gb, samples, SAMPLE_FMT_FLT);
 
+        if (samplecount < 0)
+            return -1;
+
         if(s->stereo && avctx->sample_fmt == SAMPLE_FMT_S16){
             int16_t *dst = (int16_t*)samples + samplecount * 2;
             int16_t *src = (int16_t*)samples + samplecount;