Issue #48 open

PVS-Studio messages

Anonymous created an issue

PVS-Studio:http://www.viva64.com/en/pvs-studio/

-------------------------------------------------------------------------------
Coin3D

V501 There are identical sub-expressions 'size[1] >= 0.0f' to the left and to the right of the '&&' operator. inline.cpp 409

SoVRMLInline::GLRender(SoGLRenderAction * action)
{
  ....
  if ((size[0] >= 0.0f && size[1] >= 0.0f && size[1] >= 0.0f) &&
      ((vis == ALWAYS) || 
       (vis == UNTIL_LOADED && child == NULL))) {
  ....
}
-------------------------------------------------------------------------------
Coin3D

V534 It is likely that a wrong variable is being compared inside the 'for' operator. Consider reviewing 'i'. element.cpp 996

cc_xml_elt *
cc_xml_elt_create_x(cc_xml_elt * from, cc_xml_path * path)
{
  ....
  int i;
  for ( i = 0; i < length; i++ ) {
    ....
    int child;
    for (child = 0; i < current->children.getLength(); child++)
    {
  ....
}
-------------------------------------------------------------------------------
Coin3D

V557 Array overrun is possible. The '3' index is pointing beyond array bound. somfcolorrgba.cpp 220

void
SoMFColorRGBA::set1HSVValue(int idx, const float hsva[3])
{
  this->set1HSVValue(idx, hsva[0], hsva[1], hsva[2], hsva[3]);
}
-------------------------------------------------------------------------------
Coin3D

V570 The 'v0[0]' variable is assigned to itself. sotext3.cpp 1158

void
SoText3P::generate(....)
{
  ....
  v0[0] = v0[0];
  ....
}

And:
V570 The 'v0[1]' variable is assigned to itself. sotext3.cpp 1159
V570 The 'v1[0]' variable is assigned to itself. sotext3.cpp 1160
V570 The 'v1[1]' variable is assigned to itself. sotext3.cpp 1161
V570 The 'vleft[0]' variable is assigned to itself. sotext3.cpp 1162
V570 The 'vleft[1]' variable is assigned to itself. sotext3.cpp 1163
V570 The 'vright[0]' variable is assigned to itself. sotext3.cpp 1164
V570 The 'vright[1]' variable is assigned to itself. sotext3.cpp 1165
-------------------------------------------------------------------------------
Coin3D

V595 The 'node' pointer was utilized before it was verified against nullptr. Check lines: 2397, 2407. sobasekit.cpp 2397

SbBool
SoBaseKit::setPart(const int partnum, SoNode * node)
{
  ....
  if (childlist->find(node) >= 0) {
    SoDebugError::postWarning("SoBaseKit::setPart",
      "Node pointer (%p, '%s', '%s') is "
      "already used under the same group node in the catalog "
      "as a child of part '%s' -- this is not allowed",
      node,
      node->getName().getString(),
      node->getTypeId().getName().getString(),
      catalog->getName(parentIdx).getString());
    return FALSE;
  }
  ....
  if (node)
  ....
}

And:
V595 The 'this->getAttachedField()' pointer was utilized before it was verified against nullptr. Check lines: 141, 145. sofieldsensor.cpp 141
-------------------------------------------------------------------------------
Coin3D

V598 The 'memcpy' function is used to copy the fields of 'SoPointDetail' class. Virtual method table will be damaged by this. soshape_primdata.cpp 202

class COIN_DLL_API SoDetail {
  ....
  virtual ~SoDetail();
  virtual SoDetail * copy(void) const = 0;
  ....
}

class SoPointDetail : public SoDetail {
};

void
soshape_primdata::shapeVertex(const SoPrimitiveVertex * const v)
{
  ....
  SoPointDetail* newparray = new SoPointDetail[this->arraySize];
  memcpy(newparray, this->pointDetails,
    sizeof(SoPointDetail)* this->counter);
  ....
}
-------------------------------------------------------------------------------
Coin3D

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 1205, 1206. sbprofilingdata.cpp 1206

int
SbProfilingData::operator == (const SbProfilingData & rhs) const
{
  if (this->actionType != rhs.actionType) return FALSE;
  if (this->actionStartTime != rhs.actionStopTime) return FALSE;
  if (this->actionStartTime != rhs.actionStopTime) return FALSE;
  ....
}
-------------------------------------------------------------------------------
Coin3D

V636 The expression was implicitly casted from 'int' type to 'double' type. Consider utilizing an explicit type cast to avoid overflow. An example: double A = (double)(X) * Y;. sbutmprojection.cpp 56

void
SbUTMProjection::project(....) const
{
  ....
  //Make sure the longitude is between -180.00 .. 179.9
  double LongTemp =
    (int(LongRad.deg())+180)-
    int((int(LongRad.deg())+180)/360)*360-180;
  ....
}
-------------------------------------------------------------------------------
Coin3D

V576 Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected. sbocttree.cpp 214

unsigned int SbOctTreeNode::totalNumberOfItems(void) const;

void 
SbOctTreeNode::debugTree(FILE *fp, const int indent) const
{
  ....
  (void)fprintf(fp, "%s, %d items, ",
    this->isLeaf() ? "Leaf" : "Group",
    this->totalNumberOfItems());
  ....
}

And:
V576 Incorrect format. Consider checking the fifth actual argument of the 'printf' function. The SIGNED integer type argument is expected. string.cpp 105
-------------------------------------------------------------------------------

Comments (4)

  1. Roy Walmsley

    I have been through this and fixed those elements that I found needed fixing. Others I have left and intend to leave that way unless anyone else has further comments.

  2. Log in to comment