[MPlayer-dev-eng] Probable boolean logic bug

Michael McConville mmcco at mykolab.com
Fri Apr 15 05:51:29 CEST 2016


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;


More information about the MPlayer-dev-eng mailing list