~noskcaj/ubuntu/saucy/libav/merge0.8.7-1

« back to all changes in this revision

Viewing changes to debian/patches/post-0.7.1/0046-wavpack-Check-error-codes-rather-than-working-around.patch

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2011-09-28 09:18:34 UTC
  • mfrom: (1.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20110928091834-w415mnuh06h4zpvc
Tags: 4:0.7.1-7ubuntu2
Revert "Convert package to include multiarch support."

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
5
 
 
6
(cherry picked from commit dba2b63a98bdcac7bda1a8a2c48950518c075e17)
 
7
 
 
8
Signed-off-by: Anton Khirnov <anton@khirnov.net>
 
9
---
 
10
 libavcodec/wavpack.c |   13 ++++++++++---
 
11
 1 files changed, 10 insertions(+), 3 deletions(-)
 
12
 
 
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);
 
19
         else
 
20
             samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
 
21
+
 
22
+        if (samplecount < 0)
 
23
+            return -1;
 
24
+
 
25
         samplecount >>= 1;
 
26
     }else{
 
27
         const int channel_stride = avctx->channels;
 
28
@@ -1130,11 +1134,14 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
 
29
         else
 
30
             samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
 
31
 
 
32
+        if (samplecount < 0)
 
33
+            return -1;
 
34
+
 
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;
 
39
-            while(cnt-- > 0){
 
40
+            while(cnt--){
 
41
                 *dst = *src;
 
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;
 
48
-            while(cnt-- > 0){
 
49
+            while(cnt--){
 
50
                 *dst = *src;
 
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;
 
57
-            while(cnt-- > 0){
 
58
+            while(cnt--){
 
59
                 *dst = *src;
 
60
                 src += channel_stride;
 
61
                 dst += channel_stride;
 
62
-- 
 
63
1.7.4.1
 
64