Menu ▾ ▴

#2522 Out-of-bounds read in LineLayout::CalculatePositions for empty lines?

Bug
open-fixed
nobody
5
2 days ago
2 days ago
No

In 5.6.7, LineLayout::CalculatePositions indexes chars and styles with numCharsBeforeEOL - 1:

const bool lastSegItalics = (chars[numCharsBeforeEOL - 1] != ' ') && vstyle.styles[styles[numCharsBeforeEOL - 1]].italic;

For an empty line numCharsBeforeEOL is 0, and LayoutLine calls CalculatePositions for empty lines too, so this reads before the start of both arrays. Right?

Discussion

  • Zufu Liu

    Zufu Liu - 2 days ago
    • labels: --> Scintilla, layout
     
  • Zufu Liu

    Zufu Liu - 2 days ago

    Already fixed by commit [4dfc95].

     

    Related

    Commit: [4dfc95]

    • Martijn Laan

      Martijn Laan - 2 days ago

      Ah, thanks!

       
  • Zufu Liu

    Zufu Liu - 2 days ago
    • status: open --> open-fixed
     

Log in to post a comment.