[FFmpeg-trac] #5139(avcodec:open): memory leak when invalid data is found processing input

FFmpeg trac at avcodec.org
Wed Jan 27 10:00:45 CET 2016


#5139: memory leak when invalid data is found processing input
-------------------------------------+-------------------------------------
             Reporter:  tsmith       |                    Owner:
                 Type:  defect       |                   Status:  open
             Priority:  important    |                Component:  avcodec
              Version:  git-master   |               Resolution:
             Keywords:  h264 leak    |               Blocked By:
  regression                         |  Reproduced by developer:  1
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Changes (by cehoyos):

 * keywords:  h264 leak => h264 leak regression
 * priority:  normal => important
 * status:  reopened => open
 * component:  undetermined => avcodec
 * reproduced:  0 => 1


Comment:

 Regression since 36f862e0 / a0f29460
 {{{
 $ valgrind --leak-check=full ffmpeg_g -i leak.ivf
 ==27692== Memcheck, a memory error detector
 ==27692== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
 ==27692== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright
 info
 ==27692== Command: ffmpeg_g -i leak.ivf
 ==27692==
 ffmpeg version N-78065-ge9e6233 Copyright (c) 2000-2016 the FFmpeg
 developers
   built with gcc 4.7 (SUSE Linux)
   configuration: --enable-gpl --enable-libx264
   libavutil      55. 15.100 / 55. 15.100
   libavcodec     57. 22.102 / 57. 22.102
   libavformat    57. 23.100 / 57. 23.100
   libavdevice    57.  0.100 / 57.  0.100
   libavfilter     6. 27.100 /  6. 27.100
   libswscale      4.  0.100 /  4.  0.100
   libswresample   2.  0.101 /  2.  0.101
   libpostproc    54.  0.100 / 54.  0.100
 [NULL @ 0xbaa2760] [IMGUTILS @ 0x7fefff020] Picture size 32853x9472 is
 invalid
 [ivf @ 0xba904a0] Failed to open codec in av_find_stream_info
 [NULL @ 0xbaa2760] pps_id 1363 out of range
 [NULL @ 0xbaa2760] pps_id 1343 out of range
 [NULL @ 0xbaa2760] missing picture in access unit with size 247
 [h264 @ 0xbaa2760] pps_id 1363 out of range
 [h264 @ 0xbaa2760] illegal POC type 4
 [h264 @ 0xbaa2760] illegal aspect ratio
 [h264 @ 0xbaa2760] illegal POC type 4
 [ivf @ 0xba904a0] Could not find codec parameters for stream 0 (Video:
 h264 (V264 / 0x34363256), none): unspecified size
 Consider increasing the value for the 'analyzeduration' and 'probesize'
 options
 leak.ivf: could not find codec parameters
 Input #0, ivf, from 'leak.ivf':
   Duration: N/A, bitrate: N/A
     Stream #0:0: Video: h264 (V264 / 0x34363256), none, 1.99 tbr, 1.99
 tbn, 3.98 tbc
 At least one output file must be specified
 ==27692==
 ==27692== HEAP SUMMARY:
 ==27692==     in use at exit: 1,008 bytes in 3 blocks
 ==27692==   total heap usage: 157 allocs, 154 frees, 1,642,342 bytes
 allocated
 ==27692==
 ==27692== 480 bytes in 1 blocks are definitely lost in loss record 2 of 3
 ==27692==    at 0x4C290FE: memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==27692==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==27692==    by 0x1032BCF: av_mallocz (mem.c:97)
 ==27692==    by 0x102BB8A: av_frame_alloc (frame.c:143)
 ==27692==    by 0x7A4B34: h264_init_context (h264.c:634)
 ==27692==    by 0x42984E: ff_h264_decode_init (h264.c:655)
 ==27692==    by 0xB77AAE: avcodec_open2 (utils.c:1491)
 ==27692==    by 0x6A182F: try_decode_frame (utils.c:2730)
 ==27692==    by 0x6AA325: avformat_find_stream_info (utils.c:3416)
 ==27692==    by 0x488ED0: open_input_file (ffmpeg_opt.c:970)
 ==27692==    by 0x4829D2: open_files.isra.8 (ffmpeg_opt.c:3006)
 ==27692==    by 0x48A7F0: ffmpeg_parse_options (ffmpeg_opt.c:3043)
 ==27692==
 ==27692== 480 bytes in 1 blocks are definitely lost in loss record 3 of 3
 ==27692==    at 0x4C290FE: memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==27692==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==27692==    by 0x1032BCF: av_mallocz (mem.c:97)
 ==27692==    by 0x102BB8A: av_frame_alloc (frame.c:143)
 ==27692==    by 0x7A4B45: h264_init_context (h264.c:638)
 ==27692==    by 0x42984E: ff_h264_decode_init (h264.c:655)
 ==27692==    by 0xB77AAE: avcodec_open2 (utils.c:1491)
 ==27692==    by 0x6A182F: try_decode_frame (utils.c:2730)
 ==27692==    by 0x6AA325: avformat_find_stream_info (utils.c:3416)
 ==27692==    by 0x488ED0: open_input_file (ffmpeg_opt.c:970)
 ==27692==    by 0x4829D2: open_files.isra.8 (ffmpeg_opt.c:3006)
 ==27692==    by 0x48A7F0: ffmpeg_parse_options (ffmpeg_opt.c:3043)
 ==27692==
 ==27692== LEAK SUMMARY:
 ==27692==    definitely lost: 960 bytes in 2 blocks
 ==27692==    indirectly lost: 0 bytes in 0 blocks
 ==27692==      possibly lost: 0 bytes in 0 blocks
 ==27692==    still reachable: 48 bytes in 1 blocks
 ==27692==         suppressed: 0 bytes in 0 blocks
 ==27692== Reachable blocks (those to which a pointer was found) are not
 shown.
 ==27692== To see them, rerun with: --leak-check=full --show-reachable=yes
 ==27692==
 ==27692== For counts of detected and suppressed errors, rerun with: -v
 ==27692== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 2 from 2)
 }}}

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


More information about the FFmpeg-trac mailing list