From 4ae58a720e6f8d63ff5c74fd14f630137dfd0c0c Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:52:25 -0400 Subject: Fix for invalid swizzle causing crash (#4690) * Fix for invalid swizzle causing crash Fixes #4689 If swizzle code is provided 5+ element swizzle the checkSwizzleExpr code will do an out of bounds array access and crash. * switch test to check for to ensure no crash * cleanup swizzle errors to only emit once --------- Co-authored-by: Yong He --- tests/bugs/invalid-swizzle-count.slang | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/bugs/invalid-swizzle-count.slang (limited to 'tests/bugs') diff --git a/tests/bugs/invalid-swizzle-count.slang b/tests/bugs/invalid-swizzle-count.slang new file mode 100644 index 000000000..811cf6f44 --- /dev/null +++ b/tests/bugs/invalid-swizzle-count.slang @@ -0,0 +1,11 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -emit-spirv-directly +// CHECK: error 30052 +// CHECK-NOT: error 30052 +RWStructuredBuffer outputBuffer; + +[numthreads(1,1,1)] +void computeMain( uint2 dispatchThreadID : SV_DispatchThreadID ) +{ + float4 vecVal = float4(0); + outputBuffer[0] = vecVal.xxtyxx; +} -- cgit v1.2.3