transform/BindingRemapper: Error if attempting to change access control of non-storage var
The clusterfuzz fuzzers are attempting to change the access control of a uniform variable, which produces a program that does not validate. Create an error diagnostic tagged with diag::System::Transform, which the fuzzers recognise as being invalid configuration to the transform. Fixed: chromium:1244999 Change-Id: I2d4f2dfd4f2218ac81172003872494acb027323b Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63141 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: David Neto <dneto@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
16edcf9b03
commit
14ac047d45
|
@ -113,7 +113,15 @@ void BindingRemapper::Run(CloneContext& ctx, const DataMap& inputs, DataMap&) {
|
||||||
auto ac_it = remappings->access_controls.find(from);
|
auto ac_it = remappings->access_controls.find(from);
|
||||||
if (ac_it != remappings->access_controls.end()) {
|
if (ac_it != remappings->access_controls.end()) {
|
||||||
ast::Access ac = ac_it->second;
|
ast::Access ac = ac_it->second;
|
||||||
auto* ty = ctx.src->Sem().Get(var)->Type()->UnwrapRef();
|
auto* sem = ctx.src->Sem().Get(var);
|
||||||
|
if (sem->StorageClass() != ast::StorageClass::kStorage) {
|
||||||
|
ctx.dst->Diagnostics().add_error(
|
||||||
|
diag::System::Transform,
|
||||||
|
"cannot apply access control to variable with storage class " +
|
||||||
|
std::string(ast::str(sem->StorageClass())));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto* ty = sem->Type()->UnwrapRef();
|
||||||
ast::Type* inner_ty = CreateASTTypeFor(ctx, ty);
|
ast::Type* inner_ty = CreateASTTypeFor(ctx, ty);
|
||||||
auto* new_var = ctx.dst->create<ast::Variable>(
|
auto* new_var = ctx.dst->create<ast::Variable>(
|
||||||
ctx.Clone(var->source()), ctx.Clone(var->symbol()),
|
ctx.Clone(var->source()), ctx.Clone(var->symbol()),
|
||||||
|
|
Loading…
Reference in New Issue