Browse Source

* fixed range check error if cstringpattern is empty (r14789, r14850)

git-svn-id: trunk@14906 -
Jonas Maebe 15 years ago
parent
commit
a37850742c
1 changed files with 4 additions and 1 deletions
  1. 4 1
      compiler/scanner.pas

+ 4 - 1
compiler/scanner.pas

@@ -3899,7 +3899,10 @@ In case not, the value returned can be arbitrary.
                                { convert existing string to an utf-8 string }
                                { convert existing string to an utf-8 string }
                                if not iswidestring then
                                if not iswidestring then
                                  begin
                                  begin
-                                   ascii2unicode(@cstringpattern[1],len,patternw);
+                                   if len>0 then
+                                     ascii2unicode(@cstringpattern[1],len,patternw)
+                                   else
+                                     ascii2unicode(nil,len,patternw);
                                    iswidestring:=true;
                                    iswidestring:=true;
                                    len:=0;
                                    len:=0;
                                  end;
                                  end;