Material Detail

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

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

This video was recorded at Stanford Engineering Everywhere CS107 - Programming Paradigms. 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

Quality

  • User Rating
  • Comments
  • Learning Exercises
  • Bookmark Collections
  • Course ePortfolios
  • Accessibility Info

More about this material

Comments

Log in to participate in the discussions or sign up if you are not already a MERLOT member.