[PATCH] vf_divtc.c: Ensure shift is always valid.

Reimar Döffinger <[email protected]>
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
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
[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.