Mercurial > libavcodec.hg
comparison lzw.c @ 7266:451bc2b25bcb libavcodec
check that csize in ff_lzw_decode_init is < LZW_MAXBITS, <= is not enough and
might read outside the prefix array
author | reimar |
---|---|
date | Sun, 13 Jul 2008 20:03:57 +0000 |
parents | 48759bfbd073 |
children | 04423b2f6e0b |
comparison
equal
deleted
inserted
replaced
7265:433a8fbbdd00 | 7266:451bc2b25bcb |
---|---|
129 */ | 129 */ |
130 int ff_lzw_decode_init(LZWState *p, int csize, const uint8_t *buf, int buf_size, int mode) | 130 int ff_lzw_decode_init(LZWState *p, int csize, const uint8_t *buf, int buf_size, int mode) |
131 { | 131 { |
132 struct LZWState *s = (struct LZWState *)p; | 132 struct LZWState *s = (struct LZWState *)p; |
133 | 133 |
134 if(csize < 1 || csize > LZW_MAXBITS) | 134 if(csize < 1 || csize >= LZW_MAXBITS) |
135 return -1; | 135 return -1; |
136 /* read buffer */ | 136 /* read buffer */ |
137 s->pbuf = buf; | 137 s->pbuf = buf; |
138 s->ebuf = s->pbuf + buf_size; | 138 s->ebuf = s->pbuf + buf_size; |
139 s->bbuf = 0; | 139 s->bbuf = 0; |