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

FFmpeg trac at avcodec.org
Thu Jan 7 23:23:29 CET 2016


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

 * status:  closed => reopened
 * resolution:  worksforme =>


Comment:

 I have a better test case and I have tested it with the configuration from
 your log.

 {{{
 $ valgrind --leak-check=full ./ffmpeg_g -f ivf -i test_case.ivf -f null -
 ==55920== Memcheck, a memory error detector
 ==55920== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
 ==55920== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright
 info
 ==55920== Command: ./ffmpeg_g -f ivf -i ivf_corpus/test_case.ivf -f null -
 ==55920==
 ffmpeg version N-77728-g84a967df Copyright (c) 2000-2016 the FFmpeg
 developers
   built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
   configuration: --enable-gpl
   libavutil      55. 12.100 / 55. 12.100
   libavcodec     57. 22.100 / 57. 22.100
   libavformat    57. 21.101 / 57. 21.101
   libavdevice    57.  0.100 / 57.  0.100
   libavfilter     6. 23.100 /  6. 23.100
   libswscale      4.  0.100 /  4.  0.100
   libswresample   2.  0.101 /  2.  0.101
   libpostproc    54.  0.100 / 54.  0.100
 [NULL @ 0xa203fa0] [IMGUTILS @ 0xffeffee30] Picture size 32853x9472 is
 invalid
 [ivf @ 0xa1fa780] Failed to open codec in av_find_stream_info
 [NULL @ 0xa203fa0] pps_id 1363 out of range
 [NULL @ 0xa203fa0] pps_id 1343 out of range
 [NULL @ 0xa203fa0] missing picture in access unit with size 247
 [h264 @ 0xa203fa0] pps_id 1363 out of range
 [h264 @ 0xa203fa0] illegal POC type 4
 [h264 @ 0xa203fa0] illegal aspect ratio
 [h264 @ 0xa203fa0] illegal POC type 4
 [ivf @ 0xa1fa780] 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
 ivf_corpus/test_case.ivf: could not find codec parameters
 Input #0, ivf, from 'ivf_corpus/test_case.ivf':
   Duration: N/A, bitrate: N/A
     Stream #0:0: Video: h264 (V264 / 0x34363256), none, 1.99 tbr, 1.99
 tbn, 3.98 tbc
 [buffer @ 0xa38afe0] Unable to parse option value "0x0" as image size
 [buffer @ 0xa38afe0] Unable to parse option value "-1" as pixel format
 [buffer @ 0xa38afe0] Unable to parse option value "0x0" as image size
 [buffer @ 0xa38afe0] Error setting option video_size to value 0x0.
 [graph 0 input from stream 0:0 @ 0xa38ae60] Error applying options to the
 filter.
 Error opening filters!
 ==55920==
 ==55920== HEAP SUMMARY:
 ==55920==     in use at exit: 1,006 bytes in 6 blocks
 ==55920==   total heap usage: 285 allocs, 279 frees, 1,619,103 bytes
 allocated
 ==55920==
 ==55920== 46 (16 direct, 30 indirect) bytes in 1 blocks are definitely
 lost in loss record 4 of 6
 ==55920==    at 0x4C2D110: memalign (in /usr/lib/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==55920==    by 0x4C2D227: posix_memalign (in /usr/lib/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==55920==    by 0xEBF13F: av_malloc (mem.c:97)
 ==55920==    by 0xEBF13F: av_mallocz (mem.c:254)
 ==55920==    by 0xEB29EC: av_dict_set (dict.c:85)
 ==55920==    by 0xEB29EC: av_dict_copy (dict.c:218)
 ==55920==    by 0x4815DC: new_output_stream (ffmpeg_opt.c:1289)
 ==55920==    by 0x484928: new_video_stream (ffmpeg_opt.c:1395)
 ==55920==    by 0x48704C: open_output_file (ffmpeg_opt.c:2036)
 ==55920==    by 0x488436: open_files (ffmpeg_opt.c:2999)
 ==55920==    by 0x488436: ffmpeg_parse_options (ffmpeg_opt.c:3050)
 ==55920==    by 0x475D1C: main (ffmpeg.c:4292)
 ==55920==
 ==55920== 480 bytes in 1 blocks are definitely lost in loss record 5 of 6
 ==55920==    at 0x4C2D110: memalign (in /usr/lib/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==55920==    by 0x4C2D227: posix_memalign (in /usr/lib/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==55920==    by 0xEBF13F: av_malloc (mem.c:97)
 ==55920==    by 0xEBF13F: av_mallocz (mem.c:254)
 ==55920==    by 0xEB845A: av_frame_alloc (frame.c:143)
 ==55920==    by 0x427A7B: h264_init_context (h264.c:635)
 ==55920==    by 0x427A7B: ff_h264_decode_init (h264.c:656)
 ==55920==    by 0xA8C0EE: avcodec_open2 (utils.c:1491)
 ==55920==    by 0x68BDE3: try_decode_frame (utils.c:2730)
 ==55920==    by 0x694552: avformat_find_stream_info (utils.c:3412)
 ==55920==    by 0x483623: open_input_file (ffmpeg_opt.c:970)
 ==55920==    by 0x4881F6: open_files (ffmpeg_opt.c:2999)
 ==55920==    by 0x4881F6: ffmpeg_parse_options (ffmpeg_opt.c:3036)
 ==55920==    by 0x475D1C: main (ffmpeg.c:4292)
 ==55920==
 ==55920== 480 bytes in 1 blocks are definitely lost in loss record 6 of 6
 ==55920==    at 0x4C2D110: memalign (in /usr/lib/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==55920==    by 0x4C2D227: posix_memalign (in /usr/lib/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==55920==    by 0xEBF13F: av_malloc (mem.c:97)
 ==55920==    by 0xEBF13F: av_mallocz (mem.c:254)
 ==55920==    by 0xEB845A: av_frame_alloc (frame.c:143)
 ==55920==    by 0x427A90: h264_init_context (h264.c:639)
 ==55920==    by 0x427A90: ff_h264_decode_init (h264.c:656)
 ==55920==    by 0xA8C0EE: avcodec_open2 (utils.c:1491)
 ==55920==    by 0x68BDE3: try_decode_frame (utils.c:2730)
 ==55920==    by 0x694552: avformat_find_stream_info (utils.c:3412)
 ==55920==    by 0x483623: open_input_file (ffmpeg_opt.c:970)
 ==55920==    by 0x4881F6: open_files (ffmpeg_opt.c:2999)
 ==55920==    by 0x4881F6: ffmpeg_parse_options (ffmpeg_opt.c:3036)
 ==55920==    by 0x475D1C: main (ffmpeg.c:4292)
 ==55920==
 ==55920== LEAK SUMMARY:
 ==55920==    definitely lost: 976 bytes in 3 blocks
 ==55920==    indirectly lost: 30 bytes in 3 blocks
 ==55920==      possibly lost: 0 bytes in 0 blocks
 ==55920==    still reachable: 0 bytes in 0 blocks
 ==55920==         suppressed: 0 bytes in 0 blocks
 ==55920==
 ==55920== For counts of detected and suppressed errors, rerun with: -v
 ==55920== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
 }}}

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


More information about the FFmpeg-trac mailing list