[FFmpeg-trac] #4514(avformat:new): libavformat has a few cases where it will reference uninitialized variables

FFmpeg trac at avcodec.org
Mon Apr 27 08:27:04 CEST 2015


#4514: libavformat has a few cases where it will reference uninitialized variables
---------------------------------------+----------------------------------
               Reporter:  jeremyhu     |                  Owner:
                   Type:  defect       |                 Status:  new
               Priority:  normal       |              Component:  avformat
                Version:  unspecified  |               Keywords:
             Blocked By:               |               Blocking:
Reproduced by developer:  0            |  Analyzed by developer:  0
---------------------------------------+----------------------------------
 As observed in:

 http://fate.ffmpeg.org/log.cgi?time=20150426121301&log=compile&slot=x86_64
 -darwin-clang-3.7

 {{{
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1818:9: warning: variable 'pos_min' is
 used uninitialized whenever 'if' condition is false [-Wsometimes-
 uninitialized]
     if (st->index_entries) {
         ^~~~~~~~~~~~~~~~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1851:53: note: uninitialized use occurs
 here
     pos = ff_gen_search(s, stream_index, target_ts, pos_min, pos_max,
 pos_limit,
                                                     ^~~~~~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1818:5: note: remove the 'if' if its
 condition is always true
     if (st->index_entries) {
     ^~~~~~~~~~~~~~~~~~~~~~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1802:5: note: variable 'pos_min' is
 declared here
     int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;
     ^
 }}}
 {{{
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1840:13: warning: variable 'pos_max' is
 used uninitialized whenever 'if' condition is false [-Wsometimes-
 uninitialized]
         if (index >= 0) {
             ^~~~~~~~~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1851:62: note: uninitialized use occurs
 here
     pos = ff_gen_search(s, stream_index, target_ts, pos_min, pos_max,
 pos_limit,
                                                              ^~~~~~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1840:9: note: remove the 'if' if its
 condition is always true
         if (index >= 0) {
         ^~~~~~~~~~~~~~~~
 }}}
 {{{
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1818:9: warning: variable 'pos_max' is
 used uninitialized whenever 'if' condition is false [-Wsometimes-
 uninitialized]
     if (st->index_entries) {
         ^~~~~~~~~~~~~~~~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1851:62: note: uninitialized use occurs
 here
     pos = ff_gen_search(s, stream_index, target_ts, pos_min, pos_max,
 pos_limit,
                                                              ^~~~~~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1818:5: note: remove the 'if' if its
 condition is always true
     if (st->index_entries) {
     ^~~~~~~~~~~~~~~~~~~~~~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/utils.c:1802:5: note: variable 'pos_max' is
 declared here
     int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;
     ^
 }}}
 {{{
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/webmdashenc.c:392:17: warning: variable 'ret' is
 used uninitialized whenever '||' condition is true [-Wsometimes-
 uninitialized]
             if (!filename ||
                 ^~~~~~~~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/webmdashenc.c:394:24: note: uninitialized use
 occurs here
                 return ret;
                        ^~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/webmdashenc.c:392:17: note: remove the '||' if
 its condition is always false
             if (!filename ||
                 ^~~~~~~~~~~~
 /Users/jeremy/src/ffmpeg/fate/x86_64-darwin-
 clang-3.7/src/libavformat/webmdashenc.c:388:16: note: initialize the
 variable 'ret' to silence this warning
         int ret;
                ^
                 = 0
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4514>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list