1
From 5d4c065476da547fd1a8a604e3047e1b3a7a29d8 Mon Sep 17 00:00:00 2001
2
From: Alex Converse <alex.converse@gmail.com>
3
Date: Thu, 8 Sep 2011 11:02:43 -0700
4
Subject: [PATCH 46/70] wavpack: Check error codes rather than working around error conditions.
6
(cherry picked from commit dba2b63a98bdcac7bda1a8a2c48950518c075e17)
8
Signed-off-by: Anton Khirnov <anton@khirnov.net>
10
libavcodec/wavpack.c | 13 ++++++++++---
11
1 files changed, 10 insertions(+), 3 deletions(-)
13
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
14
index 343120f..f614c7a 100644
15
--- a/libavcodec/wavpack.c
16
+++ b/libavcodec/wavpack.c
17
@@ -1119,6 +1119,10 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
18
samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S32);
20
samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
22
+ if (samplecount < 0)
27
const int channel_stride = avctx->channels;
28
@@ -1130,11 +1134,14 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
30
samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
32
+ if (samplecount < 0)
35
if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S16){
36
int16_t *dst = (int16_t*)samples + 1;
37
int16_t *src = (int16_t*)samples;
38
int cnt = samplecount;
42
src += channel_stride;
43
dst += channel_stride;
44
@@ -1143,7 +1150,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
45
int32_t *dst = (int32_t*)samples + 1;
46
int32_t *src = (int32_t*)samples;
47
int cnt = samplecount;
51
src += channel_stride;
52
dst += channel_stride;
53
@@ -1152,7 +1159,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
54
float *dst = (float*)samples + 1;
55
float *src = (float*)samples;
56
int cnt = samplecount;
60
src += channel_stride;
61
dst += channel_stride;