Menu

#1416 Cocoa xception in SetVerticalScrollPos when MaxScrollPos = 0

Bug
closed-fixed
Scintilla (812)
5
2013-01-17
2012-10-26
Mark Yen
No

(Sorry about the summary, the field is length-limited)?

When the editor's MaxScrollPos() is 0, ScintillaCocoa::SetVerticalScrollPos() will happily divide topLine by it, resulting in NaN. Passing that to setVerticalScrollPosition will raise an ObjC exception and crash; the attached patch checks that case and just sets the scroll position to 0 instead.

There may be a similar case in setting the horizontal position, but I haven't confirmed it yet... Also, while I've managed to build the sample, I haven't been able to trigger the crash without the patch; I'm suspecting that it wasn't built with CoreAnimation, but I haven't confirmed it yet.

Discussion

  • Mark Yen

    Mark Yen - 2012-10-26

    Check MaxScrollPos() before dividing

     
  • Neil Hodgson

    Neil Hodgson - 2012-10-27

    I won't be looking at this until the new year.

     
  • Neil Hodgson

    Neil Hodgson - 2012-10-27
    • assigned_to: nobody --> nyamatongwe
     
  • Neil Hodgson

    Neil Hodgson - 2012-12-30

    Committed with some extra brackets for safety and changing 0f to 0.0f as 0f produced an error about an invalid octal number.

     
  • Neil Hodgson

    Neil Hodgson - 2012-12-30
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2013-01-17
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.