Opened 3 years ago

Last modified 7 months ago

#6754 reopened defect

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 cehoyos)

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 (10)

comment:1 Changed 3 years ago by cehoyos

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 Changed 3 years ago by dcb

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 Changed 7 months ago by Balling

  • Resolution set to duplicate
  • Status changed from new to closed

Merged in #8156.

comment:4 Changed 7 months ago by Balling

  • Resolution duplicate deleted
  • Status changed from closed to reopened

What the... Okay.

comment:5 follow-up: Changed 7 months ago by cehoyos

  • Description modified (diff)

comment:6 in reply to: ↑ 5 ; follow-up: Changed 7 months ago by Balling

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...

comment:7 in reply to: ↑ 6 ; follow-up: Changed 7 months ago by cehoyos

Replying to Balling:

Replying to cehoyos:
Suspecious? Really?

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

comment:8 in reply to: ↑ 7 Changed 7 months ago by Balling

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 follow-up: Changed 7 months ago by 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?

comment:10 in reply to: ↑ 9 Changed 7 months ago by Balling

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?

Note: See TracTickets for help on using tickets.