Opened 4 years ago

Closed 3 months ago

#6754 closed defect (fixed)

libavfilter/signature_lookup.c:494: suspicious compare ?

Reported by: dcb Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

ffmpeg-3.4/libavfilter/signature_lookup.c:494]: (warning) Result of operator '|' is always true if one operand is non-zero. Did you intend to use '&'?

Source code is

        if (meandist < minmeandist ||
                status == STATUS_END_REACHED | STATUS_BEGIN_REACHED ||
                mode == MODE_FAST){

maybe better code

        if (meandist < minmeandist ||
                status == (STATUS_END_REACHED | STATUS_BEGIN_REACHED) ||
                mode == MODE_FAST){

Change History (12)

comment:1 by Carl Eugen Hoyos, 4 years ago

Please send your patches made with git format-patch to the FFmpeg development mailing list, patches (and patch suggestions) are ignored here.

How did you find the issues?

comment:2 by dcb, 4 years ago

How did you find the issues?

A static analyser called cppcheck, available from sourceforge.

I find it very useful for C and C++ development. It catches
a lot of problems compilers don't find.

comment:3 by Balling, 2 years ago

Resolution: duplicate
Status: newclosed

Merged in #8156.

comment:4 by Balling, 2 years ago

Resolution: duplicate
Status: closedreopened

What the... Okay.

comment:5 by Carl Eugen Hoyos, 2 years ago

Description: modified (diff)

in reply to:  5 ; comment:6 by Balling, 2 years ago

Replying to cehoyos:
Suspecious? Really? Now it never become 0, so mode is never checked. "Result of operator '|' is always true if one operand is non-zero." And == have higher precedence. In this case STATUS_BEGIN_REACHED is 2. So...

in reply to:  6 ; comment:7 by Carl Eugen Hoyos, 2 years ago

Replying to Balling:

Replying to cehoyos:
Suspecious? Really?

You are asking me questions but I have no idea what you want to ask...

in reply to:  7 comment:8 by Balling, 2 years ago

Replying to cehoyos:

Replying to Balling:

Replying to cehoyos:
Suspecious? Really?

You are asking me questions but I have no idea what you want to ask...

I mean brackets obviously should be there. Or you can put 1 insteed of all

status == (STATUS_END_REACHED | STATUS_BEGIN_REACHED)

comment:9 by Carl Eugen Hoyos, 2 years ago

Now I have two questions:
Why do you believe I disagree?
Why didn't you sent a patch made with git format-patch to the development mailing list?

in reply to:  9 comment:10 by Balling, 2 years ago

Replying to cehoyos:

Now I have two questions:
Why do you believe I disagree?
Why didn't you sent a patch made with git format-patch to the development mailing list?

Well, because it is already midnight here?

comment:11 by Balling, 5 months ago

Patch is here: https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210524010024.4928-1-val.zapod.vz@gmail.com/

Wow, your mailing list is also buggy, sometimes it processes patches in real time and sometimes not! WTF. P.S. sorry for a duplication too, I send that twice, it is not a bug.

Last edited 5 months ago by Balling (previous) (diff)

comment:12 by Elon Musk, 3 months ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.