issues found in VirtualBox source code checked by PSV Studio

Discussions related to using the OSE version of VirtualBox.

issues found in VirtualBox source code checked by PSV Studio

Postby Serge Kraikov » 20. Sep 2014, 13:12

I recently found the blog post http://www.viva64.com/en/b/0281/,
where the author run his C++ static analyser (PVS Studio) against VirtualBox source code, and found a couple of issues.
As I know, he does not reported found issues.
I wonder are VirtualBox developers know about these issues?
Should I create bugtracker tikets for them?
Serge Kraikov
 
Posts: 6
Joined: 19. Dec 2013, 06:37

Re: issues found in VirtualBox source code checked by PSV St

Postby mpack » 20. Sep 2014, 13:30

Are the warnings useful? Just because a static analyzer flagged some warnings doesn't mean it is right.
mpack
Site Moderator
 
Posts: 29834
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: issues found in VirtualBox source code checked by PSV St

Postby Serge Kraikov » 20. Sep 2014, 16:42

I know there should be false positive warnings, and maybe there are no serious bugs,
but most issues are suspicious, for example:

V626 Consider checking for misprints. It's possible that ',' should be replaced by ';'. ldrmemory.cpp 317

Code: Select all   Expand viewCollapse view
/*@file
 *IPRT-Binary Image Loader, The Memory/Debugger Oriented Parts.*/
RTDECL(int) RTLdrOpenInMemory(....)
{
  if (RT_SUCCESS(rc))
  {
    ....
  }
  else
    pfnDtor(pvUser),                   //<==
  *phLdrMod = NIL_RTLDRMOD;
}


V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: g_acDaysInMonthsLeap[pTime->u8Month - 1]. time.cpp 453

Code: Select all   Expand viewCollapse view
static const uint8_t g_acDaysInMonths[12] =
{
  /*Jan Feb Mar Arp May Jun Jul Aug Sep Oct Nov Dec */
    31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

static const uint8_t g_acDaysInMonthsLeap[12] =
{
  /*Jan Feb Mar Arp May Jun Jul Aug Sep Oct Nov Dec */
    31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

static PRTTIME rtTimeNormalizeInternal(PRTTIME pTime)
{
  ....
  unsigned cDaysInMonth = fLeapYear
    ? g_acDaysInMonthsLeap[pTime->u8Month - 1]          //<==
    : g_acDaysInMonthsLeap[pTime->u8Month - 1];         //<==
  ....
}
Serge Kraikov
 
Posts: 6
Joined: 19. Dec 2013, 06:37

Re: issues found in VirtualBox source code checked by PSV St

Postby mpack » 20. Sep 2014, 18:55

I agree, that comma looks suspicious given the indentation of the next line.

This is a user forum. Perhaps you should raise this on the developer mailing list rather than here.
mpack
Site Moderator
 
Posts: 29834
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: issues found in VirtualBox source code checked by PSV St

Postby frank » 24. Sep 2014, 17:07

Thank you for this notification. We went through these issues and fixed most of them. I don't think there was any serious issue (some of the issues reported in HostDrivers/Support were already fixed after 4.3.16) but nevertheless it makes sense to fix them. VBox 4.3.18 will contain a part of these fixes.

Thanks again!
frank
Oracle Corporation
 
Posts: 3362
Joined: 7. Jun 2007, 09:11
Location: Dresden, Germany
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows

Re: issues found in VirtualBox source code checked by PSV St

Postby mpack » 24. Sep 2014, 17:11

Frank, did you see the similar topic in the beta area?
mpack
Site Moderator
 
Posts: 29834
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: issues found in VirtualBox source code checked by PSV St

Postby frank » 30. Sep 2014, 15:53

No, I didn't but these are the same reports AFAICS.
frank
Oracle Corporation
 
Posts: 3362
Joined: 7. Jun 2007, 09:11
Location: Dresden, Germany
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows


Return to VirtualBox OSE

Who is online

Users browsing this forum: No registered users and 1 guest