[FFmpeg-cvslog] r19047 - trunk/libavcodec/lcldec.c

reimar subversion
Sun May 31 12:23:38 CEST 2009


Author: reimar
Date: Sun May 31 12:23:38 2009
New Revision: 19047

Log:
Change buffer size checks to avoid the undefined overflow case.

Modified:
   trunk/libavcodec/lcldec.c

Modified: trunk/libavcodec/lcldec.c
==============================================================================
--- trunk/libavcodec/lcldec.c	Sun May 31 12:16:28 2009	(r19046)
+++ trunk/libavcodec/lcldec.c	Sun May 31 12:23:38 2009	(r19047)
@@ -87,7 +87,7 @@ static unsigned int mszh_decomp(unsigned
             continue;
         }
         if ((mask & (1 << (--maskbit))) == 0) {
-            if (destptr + 4 > destptr_end)
+            if (destptr_end - destptr < 4)
                 break;
             memcpy(destptr, srcptr, 4);
             srclen -= 4;
@@ -101,7 +101,7 @@ static unsigned int mszh_decomp(unsigned
             ofs &= 0x7ff;
             srclen -= 2;
             cnt *= 4;
-            if (destptr + cnt > destptr_end) {
+            if (destptr_end - destptr < cnt) {
                 cnt =  destptr_end - destptr;
             }
             for (; cnt > 0; cnt--) {



More information about the ffmpeg-cvslog mailing list