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
10a7137d
Commit
10a7137d
authored
Jun 01, 2021
by
Shahbaz Youssefi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UBSAN error with negating 0x8000'0000
Signed-off-by:
Shahbaz Youssefi
<
ShabbyX@gmail.com
>
parent
9431c53c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
Constant.cpp
glslang/MachineIndependent/Constant.cpp
+6
-1
No files found.
glslang/MachineIndependent/Constant.cpp
View file @
10a7137d
...
@@ -529,7 +529,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
...
@@ -529,7 +529,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
case
EbtDouble
:
case
EbtDouble
:
case
EbtFloat16
:
case
EbtFloat16
:
case
EbtFloat
:
newConstArray
[
i
].
setDConst
(
-
unionArray
[
i
].
getDConst
());
break
;
case
EbtFloat
:
newConstArray
[
i
].
setDConst
(
-
unionArray
[
i
].
getDConst
());
break
;
case
EbtInt
:
newConstArray
[
i
].
setIConst
(
-
unionArray
[
i
].
getIConst
());
break
;
// Note: avoid UBSAN error regarding negating 0x80000000
case
EbtInt
:
newConstArray
[
i
].
setIConst
(
unionArray
[
i
].
getIConst
()
==
0x80000000
?
-
0x7FFFFFFF
-
1
:
-
unionArray
[
i
].
getIConst
());
break
;
case
EbtUint
:
newConstArray
[
i
].
setUConst
(
static_cast
<
unsigned
int
>
(
-
static_cast
<
int
>
(
unionArray
[
i
].
getUConst
())));
break
;
case
EbtUint
:
newConstArray
[
i
].
setUConst
(
static_cast
<
unsigned
int
>
(
-
static_cast
<
int
>
(
unionArray
[
i
].
getUConst
())));
break
;
#ifndef GLSLANG_WEB
#ifndef GLSLANG_WEB
case
EbtInt8
:
newConstArray
[
i
].
setI8Const
(
-
unionArray
[
i
].
getI8Const
());
break
;
case
EbtInt8
:
newConstArray
[
i
].
setI8Const
(
-
unionArray
[
i
].
getI8Const
());
break
;
...
...
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