The Call Stack and Stack Overflows (example in C)

preview_player
Показать описание
---

The Call Stack and Stack Overflows (example in C) // Students usually hear about the stack early on, but many don't really take the time to look at how it works until it gives them trouble. This video shows you how the call stack works and what a stack overflow is (example C code included).

Related Videos:
Make Videos:



***

Welcome! I post videos that help you learn to program and become a more confident software developer. I cover beginner-to-advanced systems topics ranging from network programming, threads, processes, operating systems, embedded systems and others. My goal is to help you get under-the-hood and better understand how computers work and how you can use them to become stronger students and more capable professional developers.

About me: I'm a computer scientist, electrical engineer, researcher, and teacher. I specialize in embedded systems, mobile computing, sensor networks, and the Internet of Things. I teach systems and networking courses at Clemson University, where I also lead the PERSIST research lab.

More about me and what I do:

To Support the Channel:
+ like, subscribe, spread the word

Рекомендации по теме
Комментарии
Автор

There's a difference between knowing a subject and understanding it and Jacob, even though his name isn't spelled with 'k', understands what he's talking about. That makes such big difference; that's why I've learned more about C programming watching his stuff for two days than other stuff for two months. Subscriber (since two days) !

jakobfredriksson
Автор

It's been a long time since the last video... Happy to see another one :)

funhuninjastudio
Автор

I haven't coded in a long time. Got let go when the pandemic started then developed a movement disorder. Your videos will be nice as a quick refresher.

XenoTravis
Автор

Good, video was complicated for me, you made it easy.💕

yourlinuxguy
Автор

Thank you ! Very helpful all the videos

MarSonyTM
Автор

Hello Jacob. Very interesting material as usual. Go ahead and make material about "Calling Conventions" as it is next interesting topic in my opinion.

rafalmichalski
Автор

Awesome, video. Love when you matter-of-factly state the hex addresses are going up and down. Not everyone reads hex bro 😂. Still, hyper useful tutorial.

Bluwonder
Автор

How to count the number of stack frames in Stack RAM just looking at stack RAM values?

aabdev
Автор

In the illustration of the stack and the heap an so on, there is a little gap above the stack. Whats that?

bretzel
Автор

thank you so much making videos like this and i am getting 100% fruitful from your videos!!!

mohammedzaid
Автор

Very interesting. Thank you for the lesson. Thanks to you I've been writing a lot more examples in C lately, you motivated to go back and write some data structures from scratch and actually understand them better than just calling a new List<T> for literally every need.

georgeb.
Автор

Your channel is exceptional. Please keep up the good work!

potreschmotre
Автор

Hello Jacob Sorber, do you think Rust will kill c/c++? Even if c/c++ used in many important software and IoT devices, I see many comments about Rust is going to replace c/c++ in the future because of its memory-safety. There are other memory-safe languages like go/java/D but they are slower than c/c++. However, It's said Rust is as fast as C/C++ and memory-safe, how is this possible? Other languages lose their speed for security but Rust doesn't, can you make a video about these topics

selimeneskaraduman
Автор

So... when you're reading it normally like you would in a disassembled/hex editor or whatever the stack actually grows upwards? I get confused by everyone putting the high addresses in their examples at the top of the diagram. And with frame pointer you meant the base pointer and not the stack pointer, right?

edit: oooh yeah so the stack pointer would in this case point to the address of the "return" variable on the stack, probably? Like...

0x0 | ...
0x4 | "return" var
0x8 | old base pointer
0xC | return address
0x10 | "counter" arg
...


Frame pointer = 0x8
Stack pointer = 0x4

kipchickensout
Автор

if you can please can you make videos about in-depth usage about gdb. i mean how to use gdb more efficiently and advance feature from the beginning.

mohammedzaid
Автор

Now this is oddly convenient. I have been trying to implement a way to manually create stack frames all day. Those pesky segmentation faults and bus errors just keep on coming.

bbq
Автор

Hi Jacob, Why the frame address can be in the middle sometimes?

ranjithmkumar
Автор

hey jacob,
about the address from the main function when we printed : &i, __builtin_frame_address
the difference between the integer storage i and the SP was 4 bytes all seems good, but when we called myfunc() the difference between : &i, __builtin_frame_address turned to be 8 bytes
i didn't get that behavior, and could u send the link related to this video -of using these commands-.

amdreadon
Автор

Do you think you could make one on setjmp.h? I recently found some code with it, and was really confused about how it worked and what it was doing. Thanks

carsonholloway
Автор

Awesome video! I really like how you explain these concepts. Question: do you ever discuss how things, like stack overflows, stack 'crushing', or buffer overflows can be used for hacking purposes? I don't mean from a "here's how you do it" perspective but from a "how it can be exploited" perspective? Or maybe even that might be too close to "how to do it". lol Anyway, thanks for posting!

TheCocoaDaddy
welcome to shbcf.ru