Menu

#11 Parsing file with inherited empty class crashes parser.

closed-fixed
G. Veith
Parser (5)
5
2007-07-15
2007-06-22
Anonymous
No

When I try to parse a file which contains a class that inherits from an empty class, the parser crashes with the error:
"The index of the list exceeds the maximum (-1)"

It only crashes if you parse both files in the same run. If you parse them one at a time, they both work fine.

I have attached a small zip which contains code that crash the parser so you can investigate.

The code is snipped from a larger unit from our project and stripped down. It will not be able to compile in Delphi, but it should illustrate the problem anyway.

Discussion

  • Nobody/Anonymous

     
  • G. Veith

    G. Veith - 2007-06-22
    • assigned_to: nobody --> gveith
    • status: open --> pending
     
  • G. Veith

    G. Veith - 2007-06-22

    Logged In: YES
    user_id=1075015
    Originator: NO

    Hello and thanks for reporting the bug.

    The error occured while searching for the default property of the class, in your case when parsing "self['string']". The class and all its ancestors are searched for the default property, testing each member of the class if it is the property. I used "repeat .. until" where a "while" should have been used, i.e. if the class has no members the first member will nevertheless be checked, which results in the index Count - 1 = -1 inside the list of members, and the error is raised.

    I fixed the problem, but the next release will probably take another two or three weeks.
    If you can't wait that long, you can also fix it yourself, just add "if i >= 0 then"
    in file Idents\UBaseIdents.pas in line 7264 in method TRecordType.GetDefaultProperty before the "repeat".
    My change is actually a bit more complex as I took the opportunity to remove the recursive nature of the method, but this should also work.

    Best regards,
    Gerold Veith

     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 22 days (the time period specified by
    the administrator of this Tracker).

     
  • SourceForge Robot

    • status: pending --> closed
     
  • G. Veith

    G. Veith - 2007-07-15
    • status: closed --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.