From 4a627011ea3e3b57f66b4bc7b6350dea3f63e1e5 Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Wed, 20 Nov 2019 13:48:15 -0600 Subject: [PATCH] SkReader32::setMemory() requires 4-byte alignment We've just been getting lucky that the char[] was 4-byte aligned. Change-Id: I550be24b0e6f074a38ef002b6b10fbdc5cdfcf2b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255557 Commit-Queue: Mike Klein Commit-Queue: Ben Wagner aka dogben Auto-Submit: Mike Klein Reviewed-by: Ben Wagner aka dogben --- tests/Reader32Test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Reader32Test.cpp b/tests/Reader32Test.cpp index 0aebc9e4eb..b0a083425c 100644 --- a/tests/Reader32Test.cpp +++ b/tests/Reader32Test.cpp @@ -81,7 +81,7 @@ DEF_TEST(Reader32, reporter) { // need to handle read(null, 0) and not get undefined behavior from memcpy { - char storage[100]; + uint32_t storage[100 / sizeof(uint32_t)]; reader.setMemory(storage, sizeof(storage)); char buffer[10]; reader.read(buffer, 0); // easy case, since we pass a ptr