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 V620…

Examples of errors detected by the V620 diagnostic

V620. Expression of sizeof(T)*N kind is summed up with pointer to T type. Consider inspecting the expression.


Apache Xerces Project

V620 It's unusual that the expression of sizeof(T) kind is being subtracted from the pointer to T type. domnormalizer.cpp 277


const XMLCh *DOMNormalizer::integerToXMLCh(unsigned int i) const
{
  XMLCh *buf = (XMLCh*)
               fMemoryManager->allocate(15 * sizeof(XMLCh));
  XMLCh *pos = buf + sizeof(buf) - sizeof(XMLCh);
  ....
}

Snes9x

V620 It's unusual that the expression of sizeof(T) kind is being summed with the pointer to T type. wsnes9x.cpp 6145


typedef wchar_t TCHAR;

INT_PTR CALLBACK DlgOpenROMProc(....)
{
  ....
  TCHAR *tmp, *tmp2;
  ....
  while(tmp2=_tcsstr(tmp, TEXT("\\")))
    tmp=tmp2+sizeof(TCHAR);
  ....
}

Most likely this is what should be written here: tmp=tmp2+1;


Miranda NG

V620 It's unusual that the expression of sizeof(T)*N kind is being summed with the pointer to T type. Scriver input.cpp 387


BOOL HandleLinkClick(....)
{
  ....
  MoveMemory(tr.lpstrText + sizeof(TCHAR)* 7,
             tr.lpstrText,
             sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 1));
  ....
}

Similar errors can be found in some other places:

  • V620 It's unusual that the expression of sizeof(T)*N kind is being summed with the pointer to T type. UInfoEx ctrl_edit.cpp 351

Chromium

V620 It's unusual that the expression of sizeof(T)*N kind is being summed with the pointer to T type. string_conversion.cc 62


int UTF8ToUTF16Char(const char *in,
                    int in_length,
                    uint16_t out[2])
{
  const UTF8 *source_ptr = reinterpret_cast<const UTF8 *>(in);
  const UTF8 *source_end_ptr = source_ptr + sizeof(char);
  uint16_t *target_ptr = out;
  uint16_t *target_end_ptr =
    target_ptr + 2 * sizeof(uint16_t); // <=
  out[0] = out[1] = 0;
  ....
}

Similar errors can be found in some other places:

  • V620 It's unusual that the expression of sizeof(T)*N kind is being summed with the pointer to T type. string_conversion.cc 106