Advertisement
PVS-StudioWarnings

PVS-Studio warning V610 for WebP

Nov 21st, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. void VP8YUVInit(void) {
  2.   ....
  3.   for (i = 0; i < 256; ++i) {
  4.     VP8kVToR[i] = (89858 * (i - 128) + YUV_HALF) >> YUV_FIX;
  5.     VP8kUToG[i] = -22014 * (i - 128) + YUV_HALF;
  6.     VP8kVToG[i] = -45773 * (i - 128);
  7.     VP8kUToB[i] = (113618 * (i - 128) + YUV_HALF) >> YUV_FIX;
  8.   }
  9.   ....
  10. }
  11.  
  12. This suspicious code was found in WebP project by PVS-Studio static code analyzer.
  13. Warning message is:
  14. V610 Unspecified behavior. Check the shift operator '>>. The left operand is negative ('(89858 * (i - 128) + YUV_HALF)' = [-11469056..11444734]). yuv.c 40
  15.  
  16. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement