aboutsummaryrefslogtreecommitdiff
path: root/tests/stack_protector_test_helper.cpp
diff options
context:
space:
mode:
authorGeorge Zacharia <george.zcharia@gmail.com>2023-08-02 07:14:58 +0530
committerGeorge Zacharia <george.zcharia@gmail.com>2023-08-02 07:14:58 +0530
commit37897a48337da83e36a5244f5241a2bdfd257e1d (patch)
tree6ddb0527cf33db0fa9964d4c2756c9fe7d5bf496 /tests/stack_protector_test_helper.cpp
parent43ecd869bdcf14fa9fb2297f822c25ebb4025ccd (diff)
parente2b2fd5475b5da5866e481bd5b72ef4333032792 (diff)
Merge tag 'android-13.0.0_r52' of https://android.googlesource.com/platform/bionic into t13.0HEADt13.0
Android 13.0.0 Release 52 (TQ3A.230605.012) Change-Id: Ic18bc3dfc28e9e23f5a96e2e74843d9e27dbe141
Diffstat (limited to 'tests/stack_protector_test_helper.cpp')
-rw-r--r--tests/stack_protector_test_helper.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/stack_protector_test_helper.cpp b/tests/stack_protector_test_helper.cpp
index fd90b939b..eddd94074 100644
--- a/tests/stack_protector_test_helper.cpp
+++ b/tests/stack_protector_test_helper.cpp
@@ -19,7 +19,8 @@ __attribute__((noinline)) void modify_stack_protector_test() {
// We can't use memset here because it's fortified, and we want to test
// the line of defense *after* that.
// Without volatile, the generic x86/x86-64 targets don't write to the stack.
- volatile char* p;
- p = reinterpret_cast<volatile char*>(&p + 1);
- *p = '\0';
+ // We can't make a constant change, since the existing byte might already have
+ // had that value.
+ volatile char* p = reinterpret_cast<volatile char*>(&p + 1);
+ *p = ~*p;
}