[FFmpeg-cvslog] h261dec, ituh263dec: ensure CLOSE_READER is done on error paths, too.

Reimar Döffinger git at videolan.org
Mon Sep 1 19:42:36 CEST 2014


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sun Aug 31 21:39:22 2014 +0200| [36c0043344fd6d99e92f42cfd1d718a9272ad632] | committer: Reimar Döffinger

h261dec, ituh263dec: ensure CLOSE_READER is done on error paths, too.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=36c0043344fd6d99e92f42cfd1d718a9272ad632
---

 libavcodec/h261dec.c    |    2 ++
 libavcodec/ituh263dec.c |    4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index c9470b1..9b95775 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -310,6 +310,7 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
         UPDATE_CACHE(re, &s->gb);
         GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TCOEFF_VLC_BITS, 2, 0);
         if (run == 66 && level) {
+            CLOSE_READER(re, &s->gb);
             av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n",
                    s->mb_x, s->mb_y);
             return -1;
@@ -332,6 +333,7 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
         }
         i += run;
         if (i >= 64) {
+            CLOSE_READER(re, &s->gb);
             av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d\n",
                    s->mb_x, s->mb_y);
             return -1;
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 168ac74..7be56bf 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -486,6 +486,7 @@ retry:
         UPDATE_CACHE(re, &s->gb);
         GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
         if (run == 66 && level){
+            CLOSE_READER(re, &s->gb);
             av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
             return -1;
         }
@@ -531,6 +532,7 @@ retry:
         }
         i += run;
         if (i >= 64){
+            CLOSE_READER(re, &s->gb);
             // redo update without last flag, revert -1 offset
             i = i - run + ((run-1)&63) + 1;
             if (i < 64) {
@@ -539,7 +541,6 @@ retry:
                 break;
             }
             if(s->alt_inter_vlc && rl == &ff_h263_rl_inter && !s->mb_intra){
-                CLOSE_READER(re, &s->gb);
                 //Looks like a hack but no, it's the way it is supposed to work ...
                 rl = &ff_rl_intra_aic;
                 i = 0;
@@ -553,7 +554,6 @@ retry:
         j = scan_table[i];
         block[j] = level;
     }
-    CLOSE_READER(re, &s->gb);
     }
 not_coded:
     if (s->mb_intra && s->h263_aic) {



More information about the ffmpeg-cvslog mailing list