changeset 4442:b514c50250f6 libavcodec

Add two extra needed bounds checks
author reimar
date Wed, 31 Jan 2007 10:29:58 +0000
parents fdb91110889b
children 54bed3ee58f3
files lzo.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lzo.c	Wed Jan 31 10:07:22 2007 +0000
+++ b/lzo.c	Wed Jan 31 10:29:58 2007 +0000
@@ -182,6 +182,8 @@
         x = GETB(c);
         if (x < 16) c.error |= LZO_ERROR;
     }
+    if (c.in > c.in_end)
+        c.error |= LZO_INPUT_DEPLETED;
     while (!c.error) {
         int cnt, back;
         if (x > 15) {
@@ -209,6 +211,10 @@
                 cnt = get_len(&c, x, 15);
                 copy(&c, cnt + 3);
                 x = GETB(c);
+                if (c.in > c.in_end) {
+                    c.error |= LZO_INPUT_DEPLETED;
+                    continue;
+                }
                 if (x >> 4)
                     continue;
                 cnt = 1;