changeset 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 e26ea20d293a
children 5d4991dd23de
files vp56.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
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++) {