[FFmpeg-trac] #9968(avcodec:new): Certain broken MP3s may cause allocation of large amounts of memory

FFmpeg trac at avcodec.org
Mon Oct 17 13:43:15 EEST 2022


#9968: Certain broken MP3s may cause allocation of large amounts of memory
------------------------------------+-----------------------------------
             Reporter:  johnt       |                    Owner:  (none)
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avcodec
              Version:  git-master  |               Resolution:
             Keywords:  mp3         |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-----------------------------------
Comment (by johnt):

 Hi, thanks a lot for the info on that max_alloc setting! I had missed that
 that existed. It does indeed work for limiting the allocation size.

 I was a little bit surprised though that the mp3 parsing didn’t seem to
 fail if the allocation failure case occurred. I can see the error log
 messages, but it seems to produce a truncated AVPacket instead of failing.
 Is that expected behavior? (This is somewhat of a tangent to the original
 problem stated in the ticket - let me know if you’d prefer that I open a
 separate ticket about this instead.)

 I.e. running something like this that has a 20 MiB single-allocation
 limit:
 {{{
 
$ ./ffprobe_g -hide_banner -max_alloc 20971520  -show_packets repro.mp3 |
 grep 'size=' | tail -n1
 }}}

 Produces:
 {{{
 [mp3 @ 0x7f18918440c0] invalid concatenated file detected - using bitrate
 for duration
 [mp3 @ 0x7f18918440c0] Estimating duration from bitrate, this may be
 inaccurate
 Input #0, mp3, from 'repro.mp3':
   Metadata:
     encoder         : Lavf59.34.101
   Duration: 03:38:37.23, start: 0.025057, bitrate: 64 kb/s
   Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 64 kb/s
 Failed to reallocate parser buffer to 20972232
 Failed to reallocate parser buffer to 20971584
 Last message repeated 2 times
 size=20970872
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9968#comment:5>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list