从缓冲区外部读取是否也算作缓冲区溢出?
我关心的是缓冲区溢出的定义。看起来它只适用于在缓冲区之外写入。
但最近我们发现了一个惊人的错误,当程序尝试从合法分配的内存块外部读取数据时,会遇到未定义的行为 - 要么因访问冲突而崩溃,要么通过网络发送不相关的数据。显然从缓冲区外部读取也不好。
从缓冲区外部读取是否算作缓冲区溢出?如果不是 - 怎么称呼它?
My concern is the definition of buffer overrun. Looks like it only applies to writing outside the buffer.
But recently we found a spectacular bug when the program attempted to read from outside the legally allocated block of memory and ran into undefined behavior - either crashed with access violation or sent unrelated data across the network. Obviously reading from outside the buffer is not good as well.
Does reading from outside the buffer count as buffer overrun? If not - how can it be called?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这不是溢出 - 毕竟,当不涉及缓冲区时,就会发生这种情况。我简单地将其称为非法内存访问。
No, it isn't an overrun - after all, this can happen when there is no buffer involved. I'd simply call it an illegal memory access.