Add input length check when fuzzing
Otherwise, the string constructor can walk off the end looking for a null terminator that never arrives. Fix some logging copypasta Bug: skia: Change-Id: I0cb1b0b75673f64a5ac647307dbc04253f707686 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199937 Reviewed-by: Kevin Lubick <kjlubick@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
e6266a2d16
commit
39cbe46df6
@ -736,8 +736,8 @@ bool FuzzSKSL2Metal(sk_sp<SkData> bytes);
|
||||
|
||||
static void fuzz_sksl2metal(sk_sp<SkData> bytes) {
|
||||
if (FuzzSKSL2Metal(bytes)) {
|
||||
SkDebugf("[terminated] Success! Compiled input to SPIRV.\n");
|
||||
SkDebugf("[terminated] Success! Compiled input to Metal.\n");
|
||||
} else {
|
||||
SkDebugf("[terminated] Could not compile input to SPIRV.\n");
|
||||
SkDebugf("[terminated] Could not compile input to Metal.\n");
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ bool FuzzSKSL2GLSL(sk_sp<SkData> bytes) {
|
||||
settings.fCaps = caps.get();
|
||||
std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
|
||||
SkSL::Program::kFragment_Kind,
|
||||
SkSL::String((const char*) bytes->data()),
|
||||
SkSL::String((const char*) bytes->data(),
|
||||
bytes->size()),
|
||||
settings);
|
||||
if (!program || !compiler.toGLSL(*program, &output)) {
|
||||
return false;
|
||||
|
@ -18,7 +18,8 @@ bool FuzzSKSL2Metal(sk_sp<SkData> bytes) {
|
||||
settings.fCaps = caps.get();
|
||||
std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
|
||||
SkSL::Program::kFragment_Kind,
|
||||
SkSL::String((const char*) bytes->data()),
|
||||
SkSL::String((const char*) bytes->data(),
|
||||
bytes->size()),
|
||||
settings);
|
||||
if (!program || !compiler.toMetal(*program, &output)) {
|
||||
return false;
|
||||
|
@ -18,7 +18,8 @@ bool FuzzSKSL2SPIRV(sk_sp<SkData> bytes) {
|
||||
settings.fCaps = caps.get();
|
||||
std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
|
||||
SkSL::Program::kFragment_Kind,
|
||||
SkSL::String((const char*) bytes->data()),
|
||||
SkSL::String((const char*) bytes->data(),
|
||||
bytes->size()),
|
||||
settings);
|
||||
if (!program || !compiler.toSPIRV(*program, &output)) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user