Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Corruption of the Heap Error Pin
ShilpiP14-Feb-11 19:13
ShilpiP14-Feb-11 19:13 
AnswerRe: Corruption of the Heap Error Pin
ShilpiP14-Feb-11 19:11
ShilpiP14-Feb-11 19:11 
AnswerRe: Corruption of the Heap Error Pin
Niklas L14-Feb-11 21:17
Niklas L14-Feb-11 21:17 
AnswerRe: Corruption of the Heap Error Pin
Stefan_Lang15-Feb-11 6:52
Stefan_Lang15-Feb-11 6:52 
GeneralRe: Corruption of the Heap Error Pin
Niklas L15-Feb-11 10:54
Niklas L15-Feb-11 10:54 
GeneralRe: Corruption of the Heap Error Pin
Stefan_Lang15-Feb-11 22:10
Stefan_Lang15-Feb-11 22:10 
GeneralRe: Corruption of the Heap Error [modified] Pin
Niklas L15-Feb-11 22:37
Niklas L15-Feb-11 22:37 
GeneralRe: Corruption of the Heap Error Pin
Stefan_Lang15-Feb-11 22:51
Stefan_Lang15-Feb-11 22:51 
I'm not a compiler but since at compile time the compiler doesn't know the string contained in title, it would translate every reference to pointsize into an offset to the start of the struct, using titleLen as length for title. At runtime, the end of title might come long before the end of the reserved string, but the remaining bytes would just be unused.

Similarly, any assignment of this struct would copy the memory block using the size determined by titleLen and stringLen (which I take to be constants that are defined elsewhere).

Assuming your interpretation would be correct, and one of these structs would use a title of 4 characters length, whereas another was defined with a title of 20 characters length, then the second gets assigned to the first. Not only would you write past the boundaries of the memory block allocated for the first struct, you'd also invalidate any pointers to elements of the first struct that point to elements past title!
GeneralRe: Corruption of the Heap Error [modified] Pin
Niklas L15-Feb-11 23:13
Niklas L15-Feb-11 23:13 
GeneralRe: Corruption of the Heap Error Pin
Niklas L16-Feb-11 6:57
Niklas L16-Feb-11 6:57 
GeneralRe: Corruption of the Heap Error Pin
Stefan_Lang16-Feb-11 22:22
Stefan_Lang16-Feb-11 22:22 
GeneralRe: Corruption of the Heap Error Pin
Niklas L16-Feb-11 23:12
Niklas L16-Feb-11 23:12 
GeneralRe: Corruption of the Heap Error Pin
Stefan_Lang17-Feb-11 1:10
Stefan_Lang17-Feb-11 1:10 
GeneralRe: Corruption of the Heap Error Pin
Niklas L17-Feb-11 1:34
Niklas L17-Feb-11 1:34 
GeneralRe: Corruption of the Heap Error Pin
Stefan_Lang17-Feb-11 1:42
Stefan_Lang17-Feb-11 1:42 
GeneralRe: Corruption of the Heap Error Pin
Foothill15-Feb-11 11:16
professionalFoothill15-Feb-11 11:16 
QuestionHow to use CMFCVisualManagerOffice2007 in dialog App? Pin
stephen_young14-Feb-11 3:24
stephen_young14-Feb-11 3:24 
AnswerRe: How to use CMFCVisualManagerOffice2007 in dialog App? Pin
David Crow14-Feb-11 3:43
David Crow14-Feb-11 3:43 
GeneralRe: How to use CMFCVisualManagerOffice2007 in dialog App? Pin
stephen_young14-Feb-11 6:14
stephen_young14-Feb-11 6:14 
QuestionMulti Language Support Pin
T.RATHA KRISHNAN14-Feb-11 2:44
T.RATHA KRISHNAN14-Feb-11 2:44 
AnswerRe: Multi Language Support Pin
loyal ginger14-Feb-11 10:16
loyal ginger14-Feb-11 10:16 
AnswerRe: Multi Language Support Pin
yu-jian14-Feb-11 16:29
yu-jian14-Feb-11 16:29 
AnswerRe: Multi Language Support Pin
ShilpiP14-Feb-11 18:17
ShilpiP14-Feb-11 18:17 
AnswerRe: Multi Language Support Pin
RaviRanjanKr16-Feb-11 3:02
professionalRaviRanjanKr16-Feb-11 3:02 
QuestionImplementing Remeber me Facility Pin
pix_programmer14-Feb-11 2:12
pix_programmer14-Feb-11 2:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.