Probable boolean logic bug

Michael McConville <[email protected]>
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <20160416211621.GA18655@thinkpad>
Hi, everyone.

It seems that there's a nonsensical if condition in the IVTV code. It
always evaluates to true because it tests the same variable against
multiple different constants. The most probable explanation is that ||
was used when && was intended.

I found this with Coccinelle.

Thanks for your time,
Michael


--- libao2/ao_ivtv.c
+++ /tmp/cocci-output-71047-6811f3-ao_ivtv.c
@@ -84,7 +84,7 @@ init (int rate, int channels, int format
   freq = rate;
 
   /* check for supported audio rate */
-  if (rate != 32000 || rate != 41000 || rate != 48000)
+  if (rate != 32000 && rate != 41000 && rate != 48000)
   {
     mp_msg (MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_UnsupSamplerate, rate);
     rate = 48000;
_______________________________________________
MPlayer-dev-eng mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.