Commit 3f964b10 authored by aurel's avatar aurel

vp56: check buffer size to fix a potential segfault

patch by Laurent Aimar  fenrir _at_ videolan _dot_ org


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21521 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 9ad9b378
...@@ -504,8 +504,12 @@ int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size, ...@@ -504,8 +504,12 @@ int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
int is_alpha, av_uninit(alpha_offset); int is_alpha, av_uninit(alpha_offset);
if (s->has_alpha) { if (s->has_alpha) {
if (remaining_buf_size < 3)
return -1;
alpha_offset = bytestream_get_be24(&buf); alpha_offset = bytestream_get_be24(&buf);
remaining_buf_size -= 3; remaining_buf_size -= 3;
if (remaining_buf_size < alpha_offset)
return -1;
} }
for (is_alpha=0; is_alpha < 1+s->has_alpha; is_alpha++) { for (is_alpha=0; is_alpha < 1+s->has_alpha; is_alpha++) {
......
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