mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 19:40:06 +00:00
Prevent crash when bad shader redeclares built-in array names it is not supposed to redeclare.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@26520 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
8a1a4a7a8b
commit
d7dfe2c2b2
@ -97,3 +97,5 @@ layout(location = 24) in vec4 ivlc[]; // ERROR
|
||||
|
||||
layout(location = 23) out vec4 ovla[2];
|
||||
layout(location = 24) out vec4 ovlb[2]; // ERROR
|
||||
|
||||
in float gl_TessLevelOuter[4]; // ERROR
|
||||
|
@ -388,7 +388,8 @@ ERROR: 0:78: 'in' : type must be an array: bla
|
||||
ERROR: 0:86: '[]' : tessellation input array size must be gl_MaxPatchVertices or implicitly sized
|
||||
ERROR: 0:96: 'location' : overlapping use of location 24
|
||||
ERROR: 0:99: 'location' : overlapping use of location 24
|
||||
ERROR: 29 compilation errors. No code generated.
|
||||
ERROR: 0:101: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved
|
||||
ERROR: 30 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 400
|
||||
|
@ -29,7 +29,8 @@ ERROR: 0:78: 'in' : type must be an array: bla
|
||||
ERROR: 0:86: '[]' : tessellation input array size must be gl_MaxPatchVertices or implicitly sized
|
||||
ERROR: 0:96: 'location' : overlapping use of location 24
|
||||
ERROR: 0:99: 'location' : overlapping use of location 24
|
||||
ERROR: 29 compilation errors. No code generated.
|
||||
ERROR: 0:101: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved
|
||||
ERROR: 30 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 400
|
||||
|
@ -2213,6 +2213,11 @@ void TParseContext::declareArray(TSourceLoc loc, TString& identifier, const TTyp
|
||||
if (! symbol) {
|
||||
bool currentScope;
|
||||
symbol = symbolTable.find(identifier, 0, ¤tScope);
|
||||
|
||||
if (symbol && builtInName(identifier) && ! symbolTable.atBuiltInLevel()) {
|
||||
// bad shader (errors already reported) trying to redeclare a built-in name as an array
|
||||
return;
|
||||
}
|
||||
if (symbol == 0 || ! currentScope) {
|
||||
//
|
||||
// Successfully process a new definition.
|
||||
|
Loading…
Reference in New Issue
Block a user