summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-06-18 14:18:47 +0200
committerEike Rathke <erack@redhat.com>2018-06-18 17:12:35 +0200
commitc8835f2f037c056d735d33e67a4025a02afa4d3d (patch)
tree5eac13811d7f87164b5cc644489de1b601a08452
parent5c0783cecb0b141885a25ca26220614ad3125f8e (diff)
Related: tdf#118073 SbiScanner::NextSym: no symbol is no symbol
Whatever may or may not advance or put back nLineIdx, if there's no progress at the end return false so we don't end up in an endless loop with the next NextSym() starting at the same position. Change-Id: I7084fea073490c15b8ff5abb3781ac82cdccd6d6 Reviewed-on: https://gerrit.libreoffice.org/56029 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
-rw-r--r--basic/source/comp/scanner.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 2365d3aeb112..fe6263a39f90 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -226,6 +226,8 @@ bool SbiScanner::NextSym()
nOldCol1 = nOldCol2 = 0;
}
+ const sal_Int32 nLineIdxScanStart = nLineIdx;
+
if(nCol < aLine.getLength() && BasicCharClass::isWhitespace(aLine[nCol]))
{
bSpaces = true;
@@ -632,6 +634,13 @@ PrevLineCommentLbl:
nCol2 = nCol2 + nLen;
nLineIdx = -1;
}
+
+ if (nLineIdx == nLineIdxScanStart)
+ {
+ GenError( ERRCODE_BASIC_SYMBOL_EXPECTED );
+ return false;
+ }
+
return true;