Opened 8 years ago

Closed 8 years ago

#5712 closed defect (wontfix)

libavformat/utils.c makes use of variables without initialization

Reported by: Jeremy Huddleston Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Caught by clang with recent master (N-81000-g6c8942c) on fate:

CC	libavformat/utils.o
src/libavformat/utils.c:2043:9: warning: variable 'pos_min' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    if (st->index_entries) {
        ^~~~~~~~~~~~~~~~~
src/libavformat/utils.c:2076:53: note: uninitialized use occurs here
    pos = ff_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit,
                                                    ^~~~~~~
src/libavformat/utils.c:2043:5: note: remove the 'if' if its condition is always true
    if (st->index_entries) {
    ^~~~~~~~~~~~~~~~~~~~~~~
src/libavformat/utils.c:2027:5: note: variable 'pos_min' is declared here
    int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;
    ^
src/libavformat/utils.c:2065:13: warning: variable 'pos_max' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        if (index >= 0) {
            ^~~~~~~~~~
src/libavformat/utils.c:2076:62: note: uninitialized use occurs here
    pos = ff_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit,
                                                             ^~~~~~~
src/libavformat/utils.c:2065:9: note: remove the 'if' if its condition is always true
        if (index >= 0) {
        ^~~~~~~~~~~~~~~~
src/libavformat/utils.c:2043:9: warning: variable 'pos_max' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    if (st->index_entries) {
        ^~~~~~~~~~~~~~~~~
src/libavformat/utils.c:2076:62: note: uninitialized use occurs here
    pos = ff_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit,
                                                             ^~~~~~~
src/libavformat/utils.c:2043:5: note: remove the 'if' if its condition is always true
    if (st->index_entries) {
    ^~~~~~~~~~~~~~~~~~~~~~~
src/libavformat/utils.c:2027:5: note: variable 'pos_max' is declared here
    int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;
    ^
3 warnings generated.

Change History (1)

comment:1 by Hendrik, 8 years ago

Resolution: wontfix
Status: newclosed

These are false positives, the code explicitly contains av_uninit macros that indicate this, unfortunately clang doesn't have a way to signal this so the macros evaluate to nothing.

Note: See TracTickets for help on using tickets.