Fix modify_stack_protector flake

The previous test would fail to crash if the first byte of the canary was
already NUL (1 of 256 runs assuming uniform canary distribution).

Bug: http://b/121156651
Test: bionic unit tests
This commit is contained in:
Ryan Prichard 2019-01-01 16:20:12 -08:00
parent 7bd54ade8d
commit 76e7fd4e26
1 changed files with 1 additions and 1 deletions

View File

@ -21,6 +21,6 @@ __attribute__((noinline)) void modify_stack_protector_test() {
// the line of defense *after* that.
// Without volatile, the generic x86/x86-64 targets don't write to the stack.
volatile char* p = buf;
int size = static_cast<int>(sizeof(buf) + 1);
int size = static_cast<int>(sizeof(buf) + sizeof(void*));
while ((p - buf) < size) *p++ = '\0';
}