summaryrefslogtreecommitdiff
path: root/basic/source/comp/loops.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-02-27 13:44:37 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2024-02-27 10:33:52 +0100
commit8bbfbe92c01bff38ed2241da56560b84f7954beb (patch)
tree7623a16362afd0ac39a195d61e2d204f0c9740d3 /basic/source/comp/loops.cxx
parent0079f0e77e74a355d57b24d3a6b6d1a29f45eb79 (diff)
tdf#159908: return early to avoid nullptr dereference
When aLvalue is not a variable, its GetRealVar() returns nullptr. That was dereferenced unconditionally later in the check of the variable after NEXT. Change-Id: Ia46f23a7e720431bf62ace998848b684aa8449e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164002 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic/source/comp/loops.cxx')
-rw-r--r--basic/source/comp/loops.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index 07aac44943a6..f903f650a2bf 100644
--- a/basic/source/comp/loops.cxx
+++ b/basic/source/comp/loops.cxx
@@ -210,6 +210,11 @@ void SbiParser::For()
if( bForEach )
Next();
SbiExpression aLvalue( this, SbOPERAND );
+ if (!aLvalue.IsVariable())
+ {
+ bAbort = true;
+ return; // the error is alredy set in SbiExpression ctor
+ }
aLvalue.Gen(); // variable on the Stack
if( bForEach )