diff options
author | George Burgess IV <gbiv@google.com> | 2022-05-23 13:05:46 -0700 |
---|---|---|
committer | Greg Schlomoff <gregschlom@google.com> | 2022-10-07 17:11:02 +0000 |
commit | 3a576d9492dc5e17b73d242c5978a46a6f17cde0 (patch) | |
tree | 15a622ffaf8864cd7c30dcb00d9035ed13d4d184 | |
parent | 01f39509a998a341e2c8b807d1a1227a787feccf (diff) | |
download | angle-3a576d9492dc5e17b73d242c5978a46a6f17cde0.tar.gz |
angle: fix potential nullptr dereference
`checkIsScalarBool` immediately deref's `typedCond`, which may be NULL.
Prevent that.
Caught by the static analyzer:
>
device/generic/vulkan-cereal/third-party/angle/src/compiler/translator/ParseContext.cpp:893:9:
warning: Called C++ object pointer is null
[clang-analyzer-core.CallAndMessage]
Bug: b:206470603
Test: None
Change-Id: I2c055d637fb3ef254c0cebfae32bfbe17bf850ea
-rw-r--r-- | src/compiler/translator/ParseContext.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp index ed359b6264..d445a7cd10 100644 --- a/src/compiler/translator/ParseContext.cpp +++ b/src/compiler/translator/ParseContext.cpp @@ -2437,7 +2437,7 @@ TIntermNode *TParseContext::addLoop(TLoopType type, } if (cond == nullptr || typedCond) { - if (type == ELoopDoWhile) + if (type == ELoopDoWhile && typedCond) { checkIsScalarBool(line, typedCond); } |