[Ffmpeg-devel] Bug in libavcodec/utils.c as of r5799

Ross Mellgren r
Thu Jul 20 02:24:01 CEST 2006


Spent today tracking down a bug in the bookkeeping in utils.c which  
caused a segfault in ffmpeg-php with apache, and thought I'd share so  
maybe someone could commit it.

The bug is that when av_free_static is called, it nulls array_static,  
but does not reset the bookkeeping counters allocated_static and  
last_static, which caused av_fast_realloc to later return a NULL (the  
current value of array_static), causing in my case init_rl to  
segfault. Clearing out these counters in av_free_static mops up the  


--- ffmpeg/libavcodec/utils.c   2006-07-18 07:00:55.000000000 -0400
+++ ffmpeg.new/libavcodec/utils.c       2006-07-19 20:03:06.000000000  
@@ -144,10 +144,12 @@
+    allocated_static = 0;
+    last_static = 0;

  * Call av_free_static automatically before it's too late

More information about the ffmpeg-devel mailing list