Skip to content

Tile corruption crash when repeatedly navigating to document start/end in @codemirror/view 6.39.x #1652

@Fergarram

Description

@Fergarram

Describe the issue

Repeatedly navigating between document start and end using Cmd+Up / Cmd+Down (or Ctrl+Home / Ctrl+End) causes a crash after approximately 3 round trips. The error originates in the tile rendering system.

Error messages:

Uncaught TypeError: Cannot destructure property 'tile' of 'parents.pop(...)' as it is undefined.
    at TilePointer.advance
    at TileUpdate.forward
    at TileUpdate.run

Followed by:

Uncaught Error: No tile at position 10316
    at DocTile.resolveBlock
    at DocView.coordsAt
    at DocView.scrollIntoView

This is not a timing issue, it reproduces even with several seconds between keystrokes.

The pattern is consistently: top -> bottom -> top -> bottom -> top (crash on third navigation to top).

Regression

Workaround

Pin @codemirror/view to 6.38.6.

Steps to reproduce

  1. Open any CodeMirror editor with a document long enough to require scrolling
  2. Press Cmd+Down (go to end)
  3. Press Cmd+Up (go to start)
  4. Repeat steps 2-3 approximately 3 times
  5. Editor crashes

Reproduction link

https://codemirror.net/examples/million/

Use any example with sufficient content, then press Cmd+Down / Cmd+Up repeatedly.

Also reproduced on the official CodeMirror website examples.

Browser and platform

Chromium Engine Version 143.0.7499.147, Safari Version 18.5 (20621.2.5.11.8), Firefox 144.0.2 (aarch64)

Reproduction link

https://codemirror.net/examples/million/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions