Bizarre error array access out of bounds

Source: Internet
Author: User

Class Ownerimage

{

Public

CSize getimagesize ();

Private

Point M_pt[2];

int m_iimgwidth;

int m_iimgheight;

}

CSize ownerimage::getimagesize ()

{

Return CSize (M_iimgwidth, m_iimgheight);

}

The rest of the function is omitted, in the process of constantly calling the GetImageSize function, the m_iimgwidth size will change, originally thought to be the csize construction problem, after the discovery CSize inherits the size, here is correct. DECLARE m_pt[2] At the end, it is found that this problem does not occur, the point array is determined to be a problem, and the other cpoint inherit from the points, after the discovery is due to use in other functions m_pt[2], and the array does not cross-border check, it directly changed the M_iimgwidth value. Take this as a ring

Bizarre error array access out of bounds

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.