PVS-StudioWarnings

PVS-Studio warning V557 for Wolf

Nov 11th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. void RB_CalcColorFromOneMinusEntity(unsigned char *dstColors) {
  2.   ...
  3.   unsigned char invModulate[3];
  4.   ...
  5.   invModulate[0] = 255 - backEnd.currentEntity->e.shaderRGBA[0];
  6.   invModulate[1] = 255 - backEnd.currentEntity->e.shaderRGBA[1];
  7.   invModulate[2] = 255 - backEnd.currentEntity->e.shaderRGBA[2];
  8.   // this trashes alpha, but the AGEN block fixes it
  9.   invModulate[3] = 255 - backEnd.currentEntity->e.shaderRGBA[3];
  10.   ...
  11. }
  12.  
  13. The same error can be found in Quake 3.
  14.  
  15. This suspicious code was found in Wolf project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V557 Array overrun is possible. The '3' index is pointing beyond array bound. renderer tr_shade_calc.c 679
  18.  
  19. 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