diff vp56.c @ 11050:170c9ce34d14 libavcodec

vp56: check buffer size to fix a potential segfault patch by Laurent Aimar fenrir _at_ videolan _dot_ org
author aurel
date Thu, 28 Jan 2010 23:49:46 +0000
parents c1cccc058c7a
children c57e72227d7d
line wrap: on
line diff
--- a/vp56.c	Thu Jan 28 23:19:33 2010 +0000
+++ b/vp56.c	Thu Jan 28 23:49:46 2010 +0000
@@ -504,8 +504,12 @@
     int is_alpha, av_uninit(alpha_offset);
 
     if (s->has_alpha) {
+        if (remaining_buf_size < 3)
+            return -1;
         alpha_offset = bytestream_get_be24(&buf);
         remaining_buf_size -= 3;
+        if (remaining_buf_size < alpha_offset)
+            return -1;
     }
 
     for (is_alpha=0; is_alpha < 1+s->has_alpha; is_alpha++) {