Lecture 14: Example in Which Writing Past the End of Array Causes the Return Address of the Function to be Overwritten

author: Jerry Cain, Computer Science Department, Stanford University
published: Sept. 7, 2010,   recorded: April 2008,   views: 2626
released under terms of: Creative Commons Attribution Non-Commercial (CC-BY-NC)

Related Open Educational Resources

Related content

Report a problem or upload files

If you have found a problem with this lecture or would like to send us extra material, articles, exercises, etc., please use our ticket system to describe your request and upload the data.
Enter your e-mail into the 'Cc' field, and we will keep you updated with your request's status.
Lecture popularity: You need to login to cast your vote.


We had something like this, where I declared an int array of length four, and int i to serve as four loop index, and then I’m just gonna go and do this. I don’t care that the array hasn’t been initialized. I want to go ahead and do this right here. And then just return. What you probably do remember from Wednesday is that given R memory model, that this would prompt the program to run forever. Why is that the case? Based on this local variable set, we’re dealing with this as an activation record. One, two, three, this is the array. As far as that four loop is concerned, it’s just one too small. This is the i variable. It goes through and it demotes all of these variables by four. ...

See the whole transcript at Programming Paradigms - Lecture 14

Link this page

Would you like to put a link to this lecture on your homepage?
Go ahead! Copy the HTML snippet !

Write your own review or comment:

make sure you have javascript enabled or clear this field: