Web lists-archives.com

[MPlayer-dev-eng] Probable boolean logic bug




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
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng