hellomotor / crashrpt

Automatically exported from code.google.com/p/crashrpt
0 stars 0 forks source link

Few issues with static code analysis #220

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
PVS-Studio. V531 It is odd that a sizeof() operator is multiplied by sizeof(). 
httprequestsender.cpp 286

BOOL CHttpRequestSender::InternalSend()
{ 
  ....
  TCHAR szBuffer[1024]=_T("");
  DWORD dwBuffSize = sizeof(szBuffer)*sizeof(TCHAR);  
  ....
}
----
V547 Expression 'pos < 0' is always false. Unsigned type value is never < 0. 
main.cpp 314

typedef std::basic_string<TCHAR> tstring;

int process_report(....)
{
  ....
  tstring sInDirName;
  ....
  size_t pos = sInDirName.rfind('\\');
  if(pos<0) // There is no back slash in path
  {
    sInDirName = _T(""); 
    sInFileName = szInput;
  }
  else
  {
    sInFileName = sInDirName.substr(pos+1);
    sInDirName = sInDirName.substr(0, pos);    
  }
  ....
}

#add
PVS-Studio. V547 Expression 'pos < 0' is always false. Unsigned type value is 
never < 0. main.cpp 352
PVS-Studio. V547 Expression 'pos >= 0' is always true. Unsigned type value is 
always >= 0. main.cpp 837
PVS-Studio. V547 Expression 'pos >= 0' is always true. Unsigned type value is 
always >= 0. minidumpreader.cpp 775
----

PVS-Studio Static Code Analyzer for C/C++/C++11 - http://www.viva64.com/

Original issue reported on code.google.com by karpov2...@gmail.com on 4 Oct 2013 at 1:19

GoogleCodeExporter commented 9 years ago
Thanks for this.

Original comment by zexspect...@gmail.com on 5 Oct 2013 at 3:57

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1632.

Original comment by zexspect...@gmail.com on 5 Oct 2013 at 3:57