Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
b5d9c11e
Commit
b5d9c11e
authored
Jul 15, 2017
by
Gabríel Arthúr Pétursson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix NULL pointer dereference in TParseContext::builtInOpCheck
parent
91e69c03
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+7
-8
No files found.
glslang/MachineIndependent/ParseHelper.cpp
View file @
b5d9c11e
...
...
@@ -1386,7 +1386,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
unaryArg
=
callNode
.
getAsUnaryNode
()
->
getOperand
();
arg0
=
unaryArg
;
}
const
TIntermSequence
&
aggArgs
=
*
argp
;
// only valid when unaryArg is nullptr
switch
(
callNode
.
getOp
())
{
case
EOpTextureGather
:
...
...
@@ -1417,7 +1416,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
profileRequires
(
loc
,
~
EEsProfile
,
400
,
E_GL_ARB_texture_gather
,
feature
);
else
profileRequires
(
loc
,
~
EEsProfile
,
400
,
E_GL_ARB_gpu_shader5
,
feature
);
if
(
!
aggArgs
[
fnCandidate
[
0
].
type
->
getSampler
().
shadow
?
3
:
2
]
->
getAsConstantUnion
())
if
(
!
(
*
argp
)
[
fnCandidate
[
0
].
type
->
getSampler
().
shadow
?
3
:
2
]
->
getAsConstantUnion
())
profileRequires
(
loc
,
EEsProfile
,
0
,
Num_AEP_gpu_shader5
,
AEP_gpu_shader5
,
"non-constant offset argument"
);
if
(
!
fnCandidate
[
0
].
type
->
getSampler
().
shadow
)
compArg
=
3
;
...
...
@@ -1427,7 +1426,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
if
(
!
fnCandidate
[
0
].
type
->
getSampler
().
shadow
)
compArg
=
3
;
// check for constant offsets
if
(
!
aggArgs
[
fnCandidate
[
0
].
type
->
getSampler
().
shadow
?
3
:
2
]
->
getAsConstantUnion
())
if
(
!
(
*
argp
)
[
fnCandidate
[
0
].
type
->
getSampler
().
shadow
?
3
:
2
]
->
getAsConstantUnion
())
error
(
loc
,
"must be a compile-time constant:"
,
feature
,
"offsets argument"
);
break
;
default
:
...
...
@@ -1435,8 +1434,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
}
if
(
compArg
>
0
&&
compArg
<
fnCandidate
.
getParamCount
())
{
if
(
aggArgs
[
compArg
]
->
getAsConstantUnion
())
{
int
value
=
aggArgs
[
compArg
]
->
getAsConstantUnion
()
->
getConstArray
()[
0
].
getIConst
();
if
(
(
*
argp
)
[
compArg
]
->
getAsConstantUnion
())
{
int
value
=
(
*
argp
)
[
compArg
]
->
getAsConstantUnion
()
->
getConstArray
()[
0
].
getIConst
();
if
(
value
<
0
||
value
>
3
)
error
(
loc
,
"must be 0, 1, 2, or 3:"
,
feature
,
"component argument"
);
}
else
...
...
@@ -1518,12 +1517,12 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
}
if
(
arg
>
0
)
{
if
(
!
aggArgs
[
arg
]
->
getAsConstantUnion
())
if
(
!
(
*
argp
)
[
arg
]
->
getAsConstantUnion
())
error
(
loc
,
"argument must be compile-time constant"
,
"texel offset"
,
""
);
else
{
const
TType
&
type
=
aggArgs
[
arg
]
->
getAsTyped
()
->
getType
();
const
TType
&
type
=
(
*
argp
)
[
arg
]
->
getAsTyped
()
->
getType
();
for
(
int
c
=
0
;
c
<
type
.
getVectorSize
();
++
c
)
{
int
offset
=
aggArgs
[
arg
]
->
getAsConstantUnion
()
->
getConstArray
()[
c
].
getIConst
();
int
offset
=
(
*
argp
)
[
arg
]
->
getAsConstantUnion
()
->
getConstArray
()[
c
].
getIConst
();
if
(
offset
>
resources
.
maxProgramTexelOffset
||
offset
<
resources
.
minProgramTexelOffset
)
error
(
loc
,
"value is out of range:"
,
"texel offset"
,
"[gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment