[FFmpeg-trac] #5584(undetermined:new): FFmpeg libraries leak 1MiB memory chunks on corrupt files

FFmpeg trac at avcodec.org
Tue Jun 14 10:07:27 CEST 2016


#5584: FFmpeg libraries leak 1MiB memory chunks on corrupt files
-------------------------------------+-------------------------------------
             Reporter:  mocmaint     |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  important    |                Component:
              Version:  git-master   |  undetermined
             Keywords:  leak         |               Resolution:
  regression                         |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by mocmaint):

 I have created a test rig for you which is available at:

     ftp://ftp.daper.net/pub/soft/moc/unstable/leak-test.c.gz

 This test rig emulates the essential behaviour of MOC and triggers the
 problem on empty and corrupt files (but not on others).

 Please read the comments at the start of the file on compiling and
 running.

 In creating this test rig, FFmpeg's behaviour became clearer.  Even though
 the read callback returns end of file (and assuming that zero represents
 that condition), FFmpeg continues making successive calls doubling the
 size of the buffer each time until the ~1MiB size is reached, after which
 it returns an error from avformat_open_input().  It is probably this
 buffer which is being leaked, even if avformat_close_input() and/or
 av_freep()s are called.  When clean up is attempted (by calling those
 functions) a segfault is sometimes triggered.

 ValGrind reports an invalid free in all cases, so FFmpeg is probably
 freeing the wrong block of storage.

 All tests above used FFmpeg at e8a236ad.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5584#comment:7>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list