[FFmpeg-cvslog] r12579 - trunk/libavcodec/utils.c

michael subversion
Tue Mar 25 11:15:17 CET 2008


Author: michael
Date: Tue Mar 25 11:15:17 2008
New Revision: 12579

Log:
Fix possible heap overflow caused by av_fast_realloc()


Modified:
   trunk/libavcodec/utils.c

Modified: trunk/libavcodec/utils.c
==============================================================================
--- trunk/libavcodec/utils.c	(original)
+++ trunk/libavcodec/utils.c	Tue Mar 25 11:15:17 2008
@@ -66,7 +66,11 @@ void *av_fast_realloc(void *ptr, unsigne
 
     *size= FFMAX(17*min_size/16 + 32, min_size);
 
-    return av_realloc(ptr, *size);
+    ptr= av_realloc(ptr, *size);
+    if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now
+        *size= 0;
+
+    return ptr;
 }
 
 static unsigned int last_static = 0;




More information about the ffmpeg-cvslog mailing list