4 ms·
You're referring to canaries, which are special values used to detect if overflows occur. Canaries are usually checked on heap deallocation (resp. stack canari
by nneonneo 8y ago
You're referring to canaries, which are special values used to detect if overflows occur.
Canaries are usually checked on heap deallocation (resp. stack canaries are checked on stack frame deallocation, i.e. function return). Checking them at any other time is expensive and incurs high overhead. They also don't catch all overflows - an overflow with an attacker-controlled index could easily skip the canary and overwrite whatever lies past it.
The problem of memory bounds checking is solvable if you decide to forego memory, processing time, and/or compatibility with existing code. Trying to achieve memory safety while maintaining those three properties is very hard.
- ElBarto 8y agoThere's no way around it. What I described is what higher-level languages do if they provide this sort of protection and it's what must do done if such protection is required.