diff options
author | Alex Converse <alex.converse@gmail.com> | 2011-09-08 22:02:43 +0400 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2011-12-24 15:20:33 +0400 |
commit | 14fae6eab0e32af483d86fb7c2ac7e69e69d638e (patch) | |
tree | a9f4d672e46549280c422466ca1d1eea105bb52a /libavcodec | |
parent | f5a8c4242eda7a41d8c93d9ddf352cb31830b06b (diff) |
wavpack: Check error codes rather than working around error conditions.
(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>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/wavpack.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 968ffa600b..db83c44132 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -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; |