Search

Illegal C++ fails to generate C2039 error, allowing buffer overrun by David_cs.1

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 612158
Opened: 10/9/2010 4:17:23 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
Illegally accessing a member of a nested structure fails to generate a C2039 error.
Interestingly, this allows a buffer overrun without using arrays, pointers, or unions.
Other compilers (g++, Sun's CC) diagnose the error.

This was reported as Bug 406512 for Visual C++ 2008, and a Microsoft comment of 3/17/2009 said "we are going to postpone addressing this problem until the next release of the product". The problem still exists in this next release.
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010

What category (if any) best represents this feedback?

Security

Steps to reproduce

Build and run the attached C++ program.

Product Language

English

Operating System

Windows Server 2008 R2

Operating System Language

English

Actual results

10 500
600 40

Expected results

Failure to compile, with two occurrences of
error C2039: 'B' : is not a member of 'A'
File Attachments
File Name Submitted By Submitted On File Size  
C2039bug.cpp 10/9/2010 693 bytes
Sign in to post a comment.
Posted by Microsoft on 12/21/2010 at 10:07 AM
Hi David:
    Thanks for reporting the issue!
    A fix for this issue has been checked into the compiler sources. The fix should show up in the next release of Visual C++.

Xiang Fan
Visual C++ Team
Posted by Microsoft on 10/9/2010 at 4:24 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.