aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkSLSPIRVTest.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2018-03-01 15:05:17 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-01 20:42:04 +0000
commit68dd2c1fa051019354d0c441c78b3885d8e72a7a (patch)
tree9b518d216d71742c1948c574db089bdc627b060e /tests/SkSLSPIRVTest.cpp
parenta7f320507dcf765313e27001774042cf1882dfea (diff)
Fixed SkSL use-after-free fuzzer bug and added defensive code to catch such problems in the future.
Bug: skia:7558 Change-Id: I5098c0ed08f2328828969e819db7785270b26656 Reviewed-on: https://skia-review.googlesource.com/111460 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'tests/SkSLSPIRVTest.cpp')
-rw-r--r--tests/SkSLSPIRVTest.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/SkSLSPIRVTest.cpp b/tests/SkSLSPIRVTest.cpp
index ba4697d191..f688d50baa 100644
--- a/tests/SkSLSPIRVTest.cpp
+++ b/tests/SkSLSPIRVTest.cpp
@@ -32,10 +32,12 @@ static void test_failure(skiatest::Reporter* r, const char* src, const char* err
DEF_TEST(SkSLBadOffset, r) {
test_failure(r,
- "struct Bad { layout (offset = 5) int x; } bad; void main() { bad.x = 5; }",
+ "struct Bad { layout (offset = 5) int x; } bad; void main() { bad.x = 5; "
+ "sk_FragColor.r = float(bad.x); }",
"error: 1: offset of field 'x' must be a multiple of 4\n1 error\n");
test_failure(r,
- "struct Bad { int x; layout (offset = 0) int y; } bad; void main() { bad.x = 5; }",
+ "struct Bad { int x; layout (offset = 0) int y; } bad; void main() { bad.x = 5; "
+ "sk_FragColor.r = float(bad.x); }",
"error: 1: offset of field 'y' must be at least 4\n1 error\n");
}