stack_painted_binary

Function stack_painted_binary 

Source
pub unsafe fn stack_painted_binary() -> u32
Expand description

Finds the number of bytes that have not been overwritten on the stack since the last repaint using binary search.

In other words: shows the worst case free stack space since repaint_stack was last called.

Uses binary search to find the point after which the stack is written. This will assume that the stack is written in a consecutive fashion. Writing somewhere out-of-order into the painted stack will not be detected.

Runs in O(log(n)) where n is the size of the stack.

Danger: if the current (active) stack contains the STACK_PAINT_VALUE this computation may be very incorrect.

ยงSafety

This function aliases the inactive stack, which is considered to be Undefined Behaviour. Do not use if you care about such things.