Web lists-archives.com

[MPlayer-dev-eng] [PATCH] vf_divtc.c: Ensure shift is always valid.




Not sure if this can actually happen, and if
it might impact performance (on x86 the compiler
should optimize the "and" away anyway).
Just thinking it might be safer, and it avoids
a Coverity warning.
---
 libmpcodecs/vf_divtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libmpcodecs/vf_divtc.c b/libmpcodecs/vf_divtc.c
index 5a23487..111e16f 100644
--- a/libmpcodecs/vf_divtc.c
+++ b/libmpcodecs/vf_divtc.c
@@ -168,7 +168,7 @@ static unsigned int checksum_plane(unsigned char *p, unsigned char *z,
       t=be2me_32(wsum);
 #endif
 
-      for(sum^=(t<<shift|t>>(32-shift)); p<e;)
+      for(sum^=(t<<shift|t>>((32-shift)&31)); p<e;)
          sum^=*p++<<(shift=(shift-8)&31);
       }
 
-- 
2.7.0

_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng