什么是堆栈溢出和缓冲区溢出错误?

发布于 2024-09-27 03:01:26 字数 405 浏览 2 评论 0原文

可能的重复:
什么是堆栈溢出错误?

嗯,我听说它是​​最常见的编写程序时遇到的错误...我对编程非常陌生,只有 2 年编码经验,但我从未真正遇到过此错误!所以,冒着听起来很愚蠢的风险,我想问一下……什么是 stackoverflow,什么是 bufferoverflow?

stackoverflow 与 bufferoverflow 有某种关系吗?

维基链接实际上对我没有帮助,因为我已经浏览过它但我不明白它。所以如果你能把它简化一下......你会怎么说?

Possible Duplicate:
What is a stack overflow error?

Well, I have heard its the most common error that one experiences while writing a program... I am very new to programming, just 2 years coding and I have never actually come across this error! So, at the risk of sounding very stupid, I would like to ask... What is stackoverflow and what is bufferoverflow?

Is stackoverflow somehow related to bufferoverflow?

A wiki link will literally not help me coz I have gone through it and am did not understand it. So if you could dumb it down.... How would you put it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

多情癖 2024-10-04 03:01:26

大多数操作系统将程序信息保存在称为堆栈和堆的数据结构中。

当向堆栈添加的信息多于允许容纳的信息时,就会发生堆栈溢出(很多时候,这种情况可能发生在没有终止子句的递归函数中)。


缓冲区是一组内存位置(通常是连续的),用于保存临时数据。当尝试写入超出缓冲区末尾的内存时,会发生缓冲区溢出。这具有安全隐患,因为有时缓冲区之外的内存不受保护,并且在执行后插入的代码可能会被执行。

Most operating system hold program information in data stuctures called a stack and a heap.

A StackOverflow occurs when one has added more information to the stack than it is allowed to hold (many times this can happen with a recursive function the doesn't have a termination clause).


A buffer is a set of memory locations (normally contiguous) that is used to hold temporary data. A buffer overflow occurs when trying to write into memory beyond the end of the buffer. This has security implications, as sometimes the memory beyond the buffer is not protected and code inserted after it may get executed.

云雾 2024-10-04 03:01:26

StackOverflow 是当你的程序执行的堆栈空间不足时会发生的情况。

前几天我遇到了一些写得不好的事件代码,其中一个事件会触发另一个事件,从而导致原始事件,依此类推,直到堆栈因方法调用而溢出。

当您尝试将数据写入超出数组末尾时,就会发生缓冲区溢出或缓冲区溢出。例如,

char* s = "hello";
s[7] = 'g';

不知道将“g”写入字符串中的位置 7 会发生什么。恶意程序员可以使用此技术在系统上执行任意代码。

A StackOverflow is what happens when you run out of stack space for you programme to execute in.

I got one the other day with some poorly written event code, where one event would trigger another event causing the original event, and so on, until the stack overflowed with method calls.

A buffer overflow or buffer overrun is what happens when you try to write data past the end of an array. For example

char* s = "hello";
s[7] = 'g';

There is no knowing what writing 'g' to the location 7 in the string will do. This technique can be used by nefarious programmers to execute arbitrary code on a system.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文