[FFmpeg-trac] #3831(avcodec:open): gif encoder uses uninitialized memory for some resolutions (was: Slight right line flickering when converting to animated .gif)

FFmpeg trac at avcodec.org
Thu Aug 7 09:05:59 CEST 2014


#3831: gif encoder uses uninitialized memory for some resolutions
------------------------------------+-----------------------------------
             Reporter:  Chillance   |                    Owner:
                 Type:  defect      |                   Status:  open
             Priority:  normal      |                Component:  avcodec
              Version:  git-master  |               Resolution:
             Keywords:  gif         |               Blocked By:
             Blocking:              |  Reproduced by developer:  1
Analyzed by developer:  0           |
------------------------------------+-----------------------------------
Changes (by cehoyos):

 * status:  new => open
 * reproduced:  0 => 1
 * component:  undetermined => avcodec
 * version:  2.3 => git-master
 * keywords:   => gif


Comment:

 For future tickets:
 Please test current FFmpeg git head before reporting problems, always
 provide the {{{ffmpeg}}} command line that allows to reproduce the issue
 together with the complete uncut console output, do not attach output
 files unless explicitely asked to and please do not attach compressed
 files (unless necessary).

 {{{
 $ ffmpeg -loop 1 -i tests/lena.pnm -s 214x214 -t 10 -qscale 2 lena.mov
 }}}
 {{{
 $ valgrind ./ffmpeg_g -i lena.mov out.gif
 ==6659== Memcheck, a memory error detector
 ==6659== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
 ==6659== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
 ==6659== Command: ./ffmpeg_g -i lena.mov out.gif
 ==6659==
 ffmpeg version N-65350-g40a820d Copyright (c) 2000-2014 the FFmpeg
 developers
   built on Aug  6 2014 21:37:45 with gcc 4.7 (SUSE Linux)
   configuration: --enable-gpl
   libavutil      52. 98.100 / 52. 98.100
   libavcodec     55. 72.102 / 55. 72.102
   libavformat    55. 51.101 / 55. 51.101
   libavdevice    55. 13.102 / 55. 13.102
   libavfilter     4. 11.102 /  4. 11.102
   libswscale      2.  6.100 /  2.  6.100
   libswresample   0. 19.100 /  0. 19.100
   libpostproc    52.  3.100 / 52.  3.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'lena.mov':
   Metadata:
     major_brand     : qt
     minor_version   : 512
     compatible_brands: qt
     encoder         : Lavf55.51.101
   Duration: 00:00:10.00, start: 0.000000, bitrate: 261 kb/s
     Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D),
 yuv420p, 214x214 [SAR 1:1 DAR 1:1], 259 kb/s, 25 fps, 25 tbr, 12800 tbn,
 25 tbc (default)
     Metadata:
       handler_name    : DataHandler
       encoder         : Lavc55.72.102 mpeg4
 ==6659== Invalid read of size 8
 ==6659==    at 0x6D2659F: __GI___strncasecmp_l (in /lib64/libc-2.15.so)
 ==6659==    by 0x6CDA8A5: ____strtod_l_internal (in /lib64/libc-2.15.so)
 ==6659==    by 0xE2C33E: av_strtod (eval.c:99)
 ==6659==    by 0xE2CB84: parse_primary (eval.c:332)
 ==6659==    by 0xE2D630: parse_factor (eval.c:492)
 ==6659==    by 0xE2D82B: parse_term (eval.c:541)
 ==6659==    by 0xE2C8CE: parse_expr (eval.c:565)
 ==6659==    by 0xE2DA2C: av_expr_parse (eval.c:683)
 ==6659==    by 0xE2DB73: av_expr_parse_and_eval (eval.c:720)
 ==6659==    by 0x4E23E6: config_props (vf_scale.c:262)
 ==6659==    by 0x495DBC: avfilter_config_links (avfilter.c:254)
 ==6659==    by 0x495D9F: avfilter_config_links (avfilter.c:243)
 ==6659==  Address 0xaff2900 is 0 bytes inside a block of size 3 alloc'd
 ==6659==    at 0x4C290FE: memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==6659==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==6659==    by 0xE35729: av_malloc (mem.c:95)
 ==6659==    by 0xE2D975: av_expr_parse (eval.c:660)
 ==6659==    by 0xE2DB73: av_expr_parse_and_eval (eval.c:720)
 ==6659==    by 0x4E23E6: config_props (vf_scale.c:262)
 ==6659==    by 0x495DBC: avfilter_config_links (avfilter.c:254)
 ==6659==    by 0x495D9F: avfilter_config_links (avfilter.c:243)
 ==6659==    by 0x49A1A8: avfilter_graph_config (avfiltergraph.c:275)
 ==6659==    by 0x47BE17: configure_filtergraph (ffmpeg_filter.c:912)
 ==6659==    by 0x4801F9: transcode_init (ffmpeg.c:2686)
 ==6659==    by 0x46B593: main (ffmpeg.c:3641)
 ==6659==
 ==6659== Invalid read of size 8
 ==6659==    at 0x6D265A7: __GI___strncasecmp_l (in /lib64/libc-2.15.so)
 ==6659==    by 0x6CDA8A5: ____strtod_l_internal (in /lib64/libc-2.15.so)
 ==6659==    by 0xE2C33E: av_strtod (eval.c:99)
 ==6659==    by 0xE2CB84: parse_primary (eval.c:332)
 ==6659==    by 0xE2D630: parse_factor (eval.c:492)
 ==6659==    by 0xE2D82B: parse_term (eval.c:541)
 ==6659==    by 0xE2C8CE: parse_expr (eval.c:565)
 ==6659==    by 0xE2DA2C: av_expr_parse (eval.c:683)
 ==6659==    by 0xE2DB73: av_expr_parse_and_eval (eval.c:720)
 ==6659==    by 0x4E23E6: config_props (vf_scale.c:262)
 ==6659==    by 0x495DBC: avfilter_config_links (avfilter.c:254)
 ==6659==    by 0x495D9F: avfilter_config_links (avfilter.c:243)
 ==6659==  Address 0xaff2908 is 5 bytes after a block of size 3 alloc'd
 ==6659==    at 0x4C290FE: memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==6659==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==6659==    by 0xE35729: av_malloc (mem.c:95)
 ==6659==    by 0xE2D975: av_expr_parse (eval.c:660)
 ==6659==    by 0xE2DB73: av_expr_parse_and_eval (eval.c:720)
 ==6659==    by 0x4E23E6: config_props (vf_scale.c:262)
 ==6659==    by 0x495DBC: avfilter_config_links (avfilter.c:254)
 ==6659==    by 0x495D9F: avfilter_config_links (avfilter.c:243)
 ==6659==    by 0x49A1A8: avfilter_graph_config (avfiltergraph.c:275)
 ==6659==    by 0x47BE17: configure_filtergraph (ffmpeg_filter.c:912)
 ==6659==    by 0x4801F9: transcode_init (ffmpeg.c:2686)
 ==6659==    by 0x46B593: main (ffmpeg.c:3641)
 ==6659==
 [swscaler @ 0xaff3080] No accelerated colorspace conversion found from
 yuv420p to bgr8.
 Output #0, gif, to 'out.gif':
   Metadata:
     major_brand     : qt
     minor_version   : 512
     compatible_brands: qt
     encoder         : Lavf55.51.101
     Stream #0:0(eng): Video: gif, bgr8, 214x214 [SAR 1:1 DAR 1:1], q=2-31,
 200 kb/s, 25 fps, 100 tbn, 25 tbc (default)
     Metadata:
       handler_name    : DataHandler
       encoder         : Lavc55.72.102 gif
 Stream mapping:
   Stream #0:0 -> #0:0 (mpeg4 (native) -> gif (native))
 Press [q] to stop, [?] for help
 ==6659== Conditional jump or move depends on uninitialised value(s)
 ==6659==    at 0x8FC128: ff_lzw_encode (lzwenc.c:105)
 ==6659==    by 0x6F06F1: gif_encode_frame (gif.c:190)
 ==6659==    by 0xA977D3: avcodec_encode_video2 (utils.c:2034)
 ==6659==    by 0x4838B1: reap_filters (ffmpeg.c:1045)
 ==6659==    by 0x46BB34: main (ffmpeg.c:3627)
 ==6659==
 ==6659== Use of uninitialised value of size 8
 ==6659==    at 0x8FC150: ff_lzw_encode (lzwenc.c:132)
 ==6659==    by 0x6F06F1: gif_encode_frame (gif.c:190)
 ==6659==    by 0xA977D3: avcodec_encode_video2 (utils.c:2034)
 ==6659==    by 0x4838B1: reap_filters (ffmpeg.c:1045)
 ==6659==    by 0x46BB34: main (ffmpeg.c:3627)
 ==6659==
 ==6659== Use of uninitialised value of size 8
 ==6659==    at 0x8FC20D: ff_lzw_encode (lzwenc.c:152)
 ==6659==    by 0x6F06F1: gif_encode_frame (gif.c:190)
 ==6659==    by 0xA977D3: avcodec_encode_video2 (utils.c:2034)
 ==6659==    by 0x4838B1: reap_filters (ffmpeg.c:1045)
 ==6659==    by 0x46BB34: main (ffmpeg.c:3627)
 ==6659==
 ==6659== Use of uninitialised value of size 8
 ==6659==    at 0x8FC173: ff_lzw_encode (lzwenc.c:246)
 ==6659==    by 0x6F06F1: gif_encode_frame (gif.c:190)
 ==6659==    by 0xA977D3: avcodec_encode_video2 (utils.c:2034)
 ==6659==    by 0x4838B1: reap_filters (ffmpeg.c:1045)
 ==6659==    by 0x46BB34: main (ffmpeg.c:3627)
 ==6659==
 ==6659== Use of uninitialised value of size 8
 ==6659==    at 0x8FC15D: ff_lzw_encode (lzwenc.c:133)
 ==6659==    by 0x6F06F1: gif_encode_frame (gif.c:190)
 ==6659==    by 0xA977D3: avcodec_encode_video2 (utils.c:2034)
 ==6659==    by 0x4838B1: reap_filters (ffmpeg.c:1045)
 ==6659==    by 0x46BB34: main (ffmpeg.c:3627)
 ==6659==
 ==6659== Conditional jump or move depends on uninitialised value(s)
 ==6659==    at 0x8FC161: ff_lzw_encode (lzwenc.c:133)
 ==6659==    by 0x6F06F1: gif_encode_frame (gif.c:190)
 ==6659==    by 0xA977D3: avcodec_encode_video2 (utils.c:2034)
 ==6659==    by 0x4838B1: reap_filters (ffmpeg.c:1045)
 ==6659==    by 0x46BB34: main (ffmpeg.c:3627)
 ==6659==
 ==6659== Conditional jump or move depends on uninitialised value(s)
 ==6659==    at 0x4C2D0E3: bcmp (in /usr/lib64/valgrind/vgpreload_memcheck-
 amd64-linux.so)
 ==6659==    by 0x6F0C92: gif_encode_frame (gif.c:99)
 ==6659==    by 0xA977D3: avcodec_encode_video2 (utils.c:2034)
 ==6659==    by 0x4838B1: reap_filters (ffmpeg.c:1045)
 ==6659==    by 0x46BB34: main (ffmpeg.c:3627)
 ==6659==
 ==6659== Conditional jump or move depends on uninitialised value(s)
 ==6659==    at 0x6F0F6A: gif_encode_frame (gif.c:121)
 ==6659==    by 0xA977D3: avcodec_encode_video2 (utils.c:2034)
 ==6659==    by 0x4838B1: reap_filters (ffmpeg.c:1045)
 ==6659==    by 0x46BB34: main (ffmpeg.c:3627)
 ==6659==
 ==6659== Conditional jump or move depends on uninitialised value(s)
 ==6659==    at 0x6F0F9F: gif_encode_frame (gif.c:121)
 ==6659==    by 0xA977D3: avcodec_encode_video2 (utils.c:2034)
 ==6659==    by 0x4838B1: reap_filters (ffmpeg.c:1045)
 ==6659==    by 0x46BB34: main (ffmpeg.c:3627)
 ==6659==
 ==6659== Conditional jump or move depends on uninitialised value(s)
 ==6659==    at 0x4C2D0E3: bcmp (in /usr/lib64/valgrind/vgpreload_memcheck-
 amd64-linux.so)
 ==6659==    by 0x6F0B9E: gif_encode_frame (gif.c:94)
 ==6659==    by 0xA977D3: avcodec_encode_video2 (utils.c:2034)
 ==6659==    by 0x4838B1: reap_filters (ffmpeg.c:1045)
 ==6659==    by 0x46BB34: main (ffmpeg.c:3627)
 ==6659==
 frame=  250 fps= 69 q=0.0 Lsize=      68kB time=00:00:10.00 bitrate=
 55.7kbits/s
 video:317kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 ==6659==
 ==6659== HEAP SUMMARY:
 ==6659==     in use at exit: 128 bytes in 3 blocks
 ==6659==   total heap usage: 42,002 allocs, 41,999 frees, 23,477,624 bytes
 allocated
 ==6659==
 ==6659== LEAK SUMMARY:
 ==6659==    definitely lost: 0 bytes in 0 blocks
 ==6659==    indirectly lost: 0 bytes in 0 blocks
 ==6659==      possibly lost: 0 bytes in 0 blocks
 ==6659==    still reachable: 128 bytes in 3 blocks
 ==6659==         suppressed: 0 bytes in 0 blocks
 ==6659== Rerun with --leak-check=full to see details of leaked memory
 ==6659==
 ==6659== For counts of detected and suppressed errors, rerun with: -v
 ==6659== Use --track-origins=yes to see where uninitialised values come
 from
 ==6659== ERROR SUMMARY: 325417 errors from 12 contexts (suppressed: 2 from
 2)
 }}}
 out.gif looks ugly.

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


More information about the FFmpeg-trac mailing list