Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: C++ semantics - 06.11

>
>
>
Examples of errors detected by the V537…

Examples of errors detected by the V537 diagnostic

V537. Potential incorrect use of item 'X'. Consider inspecting the expression.


IPP Samples

V537 Consider reviewing the correctness of 'sprite_left_coordinate' item's usage. mpeg4_enc mp4_enc_misc.cpp 387


Ipp32s ippVideoEncoderMPEG4::Init(mp4_Param *par)
{
  ....
  VOL.obmc_disable = par->obmc_disable;
  VOL.sprite_enable = par->sprite_enable;
  VOL.sprite_width = par->sprite_width;
  VOL.sprite_height = par->sprite_height;
  VOL.sprite_left_coordinate = par->sprite_left_coordinate;
  VOL.sprite_top_coordinate = par->sprite_left_coordinate;
  ....
}

An object copying error. The programmer made a misprint and typed a wrong variable.


Miranda IM

V537 Consider reviewing the correctness of 'maxX' item's usage. clist_modern modern_skinengine.cpp 2898


static BOOL ske_DrawTextEffect(....)
{
  ....
  minX=max(0,minX+mcLeftStart-2);
  minY=max(0,minY+mcTopStart-2);
  maxX=min((int)width,maxX+mcRightEnd-1);
  maxY=min((int)height,maxX+mcBottomEnd-1);
  ....
}

Most likely this is what should be written here: maxY=min((int)height,maxY+mcBottomEnd-1);


ReactOS

V537 Consider reviewing the correctness of 'x' item's usage. win32k bitblt.c 670


BOOL APIENTRY
GreStretchBltMask(....)
{
  ....
  MaskPoint.x += DCMask->ptlDCOrig.x;
  MaskPoint.y += DCMask->ptlDCOrig.x;
  ....
}

Most likely this is what should be written here: MaskPoint.y += DCMask->ptlDCOrig.y;


ReactOS

V537 Consider reviewing the correctness of 'X' item's usage. gdiplus region.c 715


GpStatus WINGDIPAPI GdipGetRegionBoundsI()
{
  ....
  if(status == Ok){
    rect->X = roundr(rectf.X);
    rect->Y = roundr(rectf.X);
    rect->Width  = roundr(rectf.Width);
    rect->Height = roundr(rectf.Height);
  }
  ....
}

This is what should have been written here: rect->Y = roundr(rectf.Y);


Quake-III-Arena

V537 Consider reviewing the correctness of 'scale_x' item's usage. Radiant terrain.cpp 1408


void Terrain_AddMovePoint(....) {
  ....
  x = ( v[ 0 ] - p->origin[ 0 ] ) / p->scale_x;
  y = ( v[ 1 ] - p->origin[ 1 ] ) / p->scale_x;
  ....
}

This is what should have been written here: y = ( v[ 1 ] - p->origin[ 1 ] ) / p->scale_y;


Trinity Core

V537 Consider reviewing the correctness of 'y' item's usage. g3dlib vector3int32.h 77


inline Vector3int32& operator+=(const Vector3int32& other) {
  x += other.x;
  y += other.y;
  z += other.y;    // <=
  return *this;
}

Blender

V537 Consider reviewing the correctness of 'x0' item's usage. extern_openjpeg tcd.c 650


void tcd_malloc_decode(....) {
  ....
  x0 = j == 0 ? tilec->x0 :
                int_min(x0, (unsigned int) tilec->x0);
  y0 = j == 0 ? tilec->y0 :
                int_min(y0, (unsigned int) tilec->x0);  // <=
  x1 = j == 0 ? tilec->x1 :
                int_max(x1, (unsigned int) tilec->x1);
  y1 = j == 0 ? tilec->y1 :
                int_max(y1, (unsigned int) tilec->y1);
  ....
}

Source Engine SDK

V537 Consider reviewing the correctness of 'y' item's usage. Raytrace trace2.cpp 189


class ALIGN16 FourVectors
{
public:
  fltx4 x, y, z;
  ....
};

FourVectors BackgroundColor;

void RayTracingEnvironment::RenderScene(....)
{
  ....
  intens.x=OrSIMD(AndSIMD(BackgroundColor.x,no_hit_mask),
                  AndNotSIMD(no_hit_mask,intens.x));
  intens.y=OrSIMD(AndSIMD(BackgroundColor.y,no_hit_mask),
                  AndNotSIMD(no_hit_mask,intens.y));
  intens.z=OrSIMD(AndSIMD(BackgroundColor.y,no_hit_mask),
                  AndNotSIMD(no_hit_mask,intens.z));

  ....
}

This is what should have been written here: intens.z=OrSIMD(AndSIMD(BackgroundColor.z,no_hit_mask), AndNotSIMD(no_hit_mask,intens.z));


Expat

V537 Consider reviewing the correctness of 'att1' item's usage. xmlwf.c 160


static int
nsattcmp(const void *p1, const void *p2)
{
  const XML_Char *att1 = *(const XML_Char **)p1;
  const XML_Char *att2 = *(const XML_Char **)p2;
  int sep1 = (tcsrchr(att1, NSSEP) != 0);
  int sep2 = (tcsrchr(att1, NSSEP) != 0);
  if (sep1 != sep2)
    return sep1 - sep2;
  return tcscmp(att1, att2);
}

FreeCAD

V537 [CWE-682] Consider reviewing the correctness of 'isArc1' item's usage. GeometryMatcher.cpp 242


TopoDS_Edge GeometryUtils::asCircle(TopoDS_Edge occEdge, bool& arc);

bool GeometryMatcher::compareBSplines(TopoDS_Edge &edge1, TopoDS_Edge &edge2)
{
  ....
  BRepAdaptor_Curve adapt1(edge1);
  BRepAdaptor_Curve adapt2(edge2);
  bool isArc1(false);
  bool isArc2(false);
  TopoDS_Edge circleEdge1;
  TopoDS_Edge circleEdge2;
  try {
    circleEdge1 = GeometryUtils::asCircle(edge1, isArc1);
    circleEdge2 = GeometryUtils::asCircle(edge2, isArc1);    // <=
  }
  catch (Base::RuntimeError&) {
    Base::Console().Error(....);
    return false;
  }
  if (!isArc1 && !isArc2) {
    return compareCircles(circleEdge1, circleEdge2);
  }
  if (isArc1 && isArc2) {
    return compareCircleArcs(circleEdge1, circleEdge2);
  }

  return false;
}