From 72a510ce71f0827407650b0301323194914cc076 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 26 Apr 2018 16:36:15 +0000 Subject: [PATCH] fixed: JSONToSpaceParser incorrectly read the last character from an UTF8 string (a last character before terminating zero char) it caused a syntax error when parsing git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1101 e52654a7-88a9-db11-a3e9-0013d4bc506e --- space/jsontospaceparser.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/space/jsontospaceparser.cpp b/space/jsontospaceparser.cpp index cb59e75..0799054 100644 --- a/space/jsontospaceparser.cpp +++ b/space/jsontospaceparser.cpp @@ -737,13 +737,11 @@ bool correct; { size_t len = PT::UTF8ToInt(pchar_ascii, c, correct); pchar_ascii += len; - - if( *pchar_ascii == 0 ) - return lastc; } - while( !correct ); + while( *pchar_ascii && !correct ); - lastc = c; + if( correct ) + lastc = c; if( lastc == '\n' ) ++line;