fedora 24
integer weakness #12

2

Weakness Breakdown


Definition:

An integer overflow occurs when the answer to an arithmetic operation exceeds the maximum size of the integer type used to store it. The resulting value will appear to have wrapped around the maximum value and started again at the minimum value. This would look like a clock that represents 13:00 by pointing at 1:00. An attacker can use an integer overflow during a buffer length calculation, which results in the allocated buffer being too small to hold the data copied into it, thus causing a buffer overflow.

Warning code(s):

Unless checked, the resulting number can exceed the expected range.

File Name:

SoQt-1.5.0/src/Inventor/Qt/SoQt.cpp

Context:

The highlighted line of code below is the trigger point of this particular Fedora 24 integer weakness.

 
  delete SoQtP::timerqueuetimer; SoQtP::timerqueuetimer = NULL;
  delete SoQtP::idletimer; SoQtP::idletimer = NULL;
  delete SoQtP::delaytimeouttimer; SoQtP::delaytimeouttimer = NULL;

  if (SoQtP::didcreatemainwidget) {
    delete SoQtP::mainwidget;
    SoQtP::mainwidget = NULL;
    SoQtP::didcreatemainwidget = FALSE;
  }

  delete SoQtP::slotobj; SoQtP::slotobj = NULL;

  // Notice that by default we *don't* delete the QApplication object,
  // even though it originated with us, as it might be used someplace
  // else in the application.
  //
  // Because there are situations where it is useful to have it
  // deleted, we provide this possibility through setting an envvar
  // (so the app programmer must actively seek out and know what she
  // is doing):

  if (SoQtP::madeappobject) {
    const char * env = SoAny::si()->getenv("SOQT_DELETE_QAPPLICATION");
    if (env && atoi(env) > 0) {
      delete SoQtP::appobject; SoQtP::appobject = NULL;
      SoQtP::madeappobject = FALSE;
    }
  }

#if 0 // FIXME: These methods exist in TGS Inventor. We should add
      // them, and then call them from here. 20060210 kyrah
  SoInteraction::finish();
  SoNodeKit::finish();
#endif
  SoDB::finish();
}


// Documented in common/SoGuiCommon.cpp.in.
QWidget *
SoQt::getTopLevelWidget(void)
{
  return SoQtP::mainwidget;
}

/*!
  Returns a pointer to the Qt QWidget which is the top level widget for the
  given QWidget \a w. This is just a convenience function provided for
  easier porting of Open Inventor applications based on SoXt components, 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.