Browse Source

* small checks added to avoid accessing potentially unalloced mem.

git-svn-id: trunk@17860 -
marco 14 years ago
parent
commit
4f12937bb3
1 changed files with 3 additions and 3 deletions
  1. 3 3
      packages/fcl-passrc/src/pparser.pp

+ 3 - 3
packages/fcl-passrc/src/pparser.pp

@@ -3524,18 +3524,18 @@ var
       Move(Start^, s[1], l)
     else
       exit;
-    if s[1] = '-' then
+    if (s[1] = '-') and (length(s)>1) then
     begin
       case s[2] of
         'd': // -d define
           Scanner.Defines.Append(UpperCase(Copy(s, 3, Length(s))));
         'F': // -F
-          if s[3] = 'i' then // -Fi include path
+          if (length(s)>2) and (s[3] = 'i') then // -Fi include path
             FileResolver.AddIncludePath(Copy(s, 4, Length(s)));
         'I': // -I include path
           FileResolver.AddIncludePath(Copy(s, 3, Length(s)));
         'S': // -S mode
-          if s[3]='d' then
+          if  (length(s)>2) and (s[3]='d') then
             begin // -Sd mode delphi
               include(Scanner.Options,po_delphi);
               include(Parser.Options,po_delphi);