Commit 36c00433 authored by Reimar Döffinger's avatar Reimar Döffinger

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

Signed-off-by: 's avatarReimar Döffinger <Reimar.Doeffinger@gmx.de>
parent 2a00812d
...@@ -310,6 +310,7 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded) ...@@ -310,6 +310,7 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
UPDATE_CACHE(re, &s->gb); UPDATE_CACHE(re, &s->gb);
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TCOEFF_VLC_BITS, 2, 0); GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TCOEFF_VLC_BITS, 2, 0);
if (run == 66 && level) { if (run == 66 && level) {
CLOSE_READER(re, &s->gb);
av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n",
s->mb_x, s->mb_y); s->mb_x, s->mb_y);
return -1; return -1;
...@@ -332,6 +333,7 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded) ...@@ -332,6 +333,7 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
} }
i += run; i += run;
if (i >= 64) { if (i >= 64) {
CLOSE_READER(re, &s->gb);
av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d\n", av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d\n",
s->mb_x, s->mb_y); s->mb_x, s->mb_y);
return -1; return -1;
......
...@@ -486,6 +486,7 @@ retry: ...@@ -486,6 +486,7 @@ retry:
UPDATE_CACHE(re, &s->gb); UPDATE_CACHE(re, &s->gb);
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
if (run == 66 && level){ 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); av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
...@@ -531,6 +532,7 @@ retry: ...@@ -531,6 +532,7 @@ retry:
} }
i += run; i += run;
if (i >= 64){ if (i >= 64){
CLOSE_READER(re, &s->gb);
// redo update without last flag, revert -1 offset // redo update without last flag, revert -1 offset
i = i - run + ((run-1)&63) + 1; i = i - run + ((run-1)&63) + 1;
if (i < 64) { if (i < 64) {
...@@ -539,7 +541,6 @@ retry: ...@@ -539,7 +541,6 @@ retry:
break; break;
} }
if(s->alt_inter_vlc && rl == &ff_h263_rl_inter && !s->mb_intra){ 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 ... //Looks like a hack but no, it's the way it is supposed to work ...
rl = &ff_rl_intra_aic; rl = &ff_rl_intra_aic;
i = 0; i = 0;
...@@ -553,7 +554,6 @@ retry: ...@@ -553,7 +554,6 @@ retry:
j = scan_table[i]; j = scan_table[i];
block[j] = level; block[j] = level;
} }
CLOSE_READER(re, &s->gb);
} }
not_coded: not_coded:
if (s->mb_intra && s->h263_aic) { if (s->mb_intra && s->h263_aic) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment