Opened 6 years ago

Closed 6 years ago

#1596 closed defect (fixed)

[with patch, review/change] preparser hangs if line starts with ...

Reported by: wjp Owned by: was
Priority: blocker Milestone: sage-2.9.2
Component: user interface Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

As reported by 'Octoploid' on IRC: The preparser crashes if a line starts with '...'.

This is caused by a string index in preparse_ellipsis() becoming negative and wrapping to the end of the string.

Patch attached. This makes preparse('...') return 'Ellipsis'. Not sure if that's the desired behaviour. Maybe a syntax error would be better?

Attachments (2)

preparse_ellipsis.patch (515 bytes) - added by wjp 6 years ago.
1596-ellipsis-bug.diff (1.4 KB) - added by robertwb 6 years ago.

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by wjp

comment:1 Changed 6 years ago by wjp

  • Component changed from algebraic geometry to user interface
  • Priority changed from major to blocker

comment:2 Changed 6 years ago by mabshoff

  • Milestone set to sage-2.9.2

comment:3 Changed 6 years ago by mabshoff

  • Summary changed from preparser hangs if line starts with ... to [with patch, needs review] preparser hangs if line starts with ...

Changed 6 years ago by robertwb

comment:4 Changed 6 years ago by robertwb

  • Summary changed from [with patch, needs review] preparser hangs if line starts with ... to [with patch, review/change] preparser hangs if line starts with ...

This patch fixes the problem.

I agree that a syntax error would be preferable, see second patch (to replace the first). I also made the error on [1..] more explicit.

comment:5 Changed 6 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from new to closed

Looks good to me. Merged in Sage 2.9.2.rc1.

Note: See TracTickets for help on using tickets.