2020-04-18 04:43:10 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2020 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "tests/Test.h"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "src/gpu/GrShaderCaps.h"
|
|
|
|
#include "src/sksl/SkSLCompiler.h"
|
|
|
|
#include "src/sksl/SkSLString.h"
|
|
|
|
#include "src/sksl/ir/SkSLProgram.h"
|
|
|
|
|
2020-04-20 02:05:12 +00:00
|
|
|
DEF_TEST(crbug_ossfuzz_21688_interfaceblock, reporter) {
|
|
|
|
// Tests that arrays of zero-sized interface blocks are disallowed.
|
2020-04-18 04:43:10 +00:00
|
|
|
SkSL::Compiler compiler;
|
|
|
|
SkSL::String output;
|
|
|
|
SkSL::Program::Settings settings;
|
|
|
|
sk_sp<GrShaderCaps> caps = SkSL::ShaderCapsFactory::Default();
|
|
|
|
settings.fCaps = caps.get();
|
2020-04-20 02:05:12 +00:00
|
|
|
const char* const kProgramText = "testBlock {} x[2];";
|
|
|
|
std::unique_ptr<SkSL::Program> program = compiler.convertProgram(SkSL::Program::kFragment_Kind,
|
|
|
|
kProgramText, settings);
|
|
|
|
REPORTER_ASSERT(reporter, program == nullptr);
|
|
|
|
REPORTER_ASSERT(reporter, compiler.errorText().find("interface block 'testBlock' must "
|
|
|
|
"contain at least one member") != -1);
|
2020-04-18 04:43:10 +00:00
|
|
|
}
|