Advertisement
PVS-StudioWarnings

PVS-Studio warning V557 for Skia

Nov 10th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. static void p3d_interp(const SkScalar src[3],
  2.                        SkScalar dst[3], SkScalar t) {
  3.     SkScalar ab = SkScalarInterp(src[0], src[3], t);
  4.     SkScalar bc = SkScalarInterp(src[3], src[6], t);
  5.     dst[0] = ab;
  6.     dst[3] = SkScalarInterp(ab, bc, t);
  7.     dst[6] = bc;
  8. }
  9.  
  10. void SkConic::chopAt(SkScalar t, SkConic dst[2]) const {
  11.   SkP3D tmp[3], tmp2[3];
  12.  
  13.   ratquad_mapTo3D(fPts, fW, tmp);
  14.  
  15.   p3d_interp(&tmp[0].fX, &tmp2[0].fX, t);
  16.   p3d_interp(&tmp[0].fY, &tmp2[0].fY, t);
  17.   p3d_interp(&tmp[0].fZ, &tmp2[0].fZ, t);
  18.   ....
  19. }
  20.  
  21. This suspicious code was found in Skia project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V557 Array overrun is possible. The '3' index is pointing beyond array bound. skgeometry.cpp 1480
  24.  
  25. 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