summaryrefslogtreecommitdiff
path: root/libavcodec/huffyuvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-29 19:10:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-29 19:11:28 +0100
commit0dfc01c2bbf4b71bb56201bc4a393321e15d1b31 (patch)
tree4259c21d38e1297d3f027ffff67189d0d9459735 /libavcodec/huffyuvdec.c
parent4420b414420ecd67e63820c556c8cadee0cc13c8 (diff)
huffyuvdec: Skip len==0 cases
Fixes vlc decoding for hypothetical files that would contain such cases. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/huffyuvdec.c')
-rw-r--r--libavcodec/huffyuvdec.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index d11dab7d28..2c56bfa493 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -120,11 +120,11 @@ static int generate_joint_tables(HYuvContext *s)
for (i = y = 0; y < 256; y++) {
int len0 = s->len[0][y];
int limit = VLC_BITS - len0;
- if(limit <= 0)
+ if(limit <= 0 || !len0)
continue;
for (u = 0; u < 256; u++) {
int len1 = s->len[p][u];
- if (len1 > limit)
+ if (len1 > limit || !len1)
continue;
av_assert0(i < (1 << VLC_BITS));
len[i] = len0 + len1;
@@ -150,17 +150,17 @@ static int generate_joint_tables(HYuvContext *s)
for (i = 0, g = -16; g < 16; g++) {
int len0 = s->len[p0][g & 255];
int limit0 = VLC_BITS - len0;
- if (limit0 < 2)
+ if (limit0 < 2 || !len0)
continue;
for (b = -16; b < 16; b++) {
int len1 = s->len[p1][b & 255];
int limit1 = limit0 - len1;
- if (limit1 < 1)
+ if (limit1 < 1 || !len1)
continue;
code = (s->bits[p0][g & 255] << len1) + s->bits[p1][b & 255];
for (r = -16; r < 16; r++) {
int len2 = s->len[2][r & 255];
- if (len2 > limit1)
+ if (len2 > limit1 || !len2)
continue;
av_assert0(i < (1 << VLC_BITS));
len[i] = len0 + len1 + len2;