Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on reverseIndex #256

Open
migueldeicaza opened this issue Sep 28, 2022 · 0 comments
Open

Crash on reverseIndex #256

migueldeicaza opened this issue Sep 28, 2022 · 0 comments

Comments

@migueldeicaza
Copy link
Owner

I caught the issue in the wild, the crash is:

    frame #3: 0x000000019475f134 libswiftCore.dylib`Swift._assertionFailure(_: Swift.StaticString, _: Swift.String, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 652
    frame #4: 0x0000000102b7f84c LaTerminal`CircularList.shiftElements(start=47, count=3, offset=1, self=0x0000000280bf5680) at CircularList.swift:169:9
  * frame #5: 0x0000000102beebe4 LaTerminal`Terminal.reverseIndex(self=0x00000001043e4ed0) at Terminal.swift:4937:26
    frame #6: 0x0000000102bbeb98 LaTerminal`closure #84 in Terminal.configureParser(collect=0 values, flag=77, self=0x00000001043e4ed0) at Terminal.swift:868:76

The issue is that shiftElements is being called with start=47, but the buffer itself only has 42 lines. The 47 is a combination of buffer.y = 21 and buffer.base = 26. And also notice that buffer.y = buffer.scrollTop which is why this path is triggered at all, originMode=false, usingMargins() = false

I was running top, and messing up the display with debug output from a background process, and I had refreshed it a few times, and I had just attempted to go to the background with control-z

The data was:
[0] = "\r"
[1] = "\u{1b}"
[2] = "["
[3] = "3"
[4] = "4"
[5] = "d"
[6] = "\u{1b}"
[7] = "["
[8] = "L"
[9] = "\u{1b}"
[10] = "["
[11] = "2"
[12] = "2"
[13] = ";"
[14] = "2"
[15] = "5"
[16] = "r"
[17] = "\u{1b}"
[18] = "["
[19] = "2"
[20] = "2"
[21] = ";"
[22] = "1"
[23] = "H"
[24] = "\u{1b}"
[25] = "M"
}

Cursor Vertical Absolute Position 34
Insert Line
Set Top and Bottom Margin to 22;25 (sets buffer.scrollBottom = 24, buffer.scrollTop=21)
Set Cursor Position 22;1
Reverse Index

Most likely, what we have here are two different buffers in action.

migueldeicaza added a commit that referenced this issue Feb 10, 2023
…on bug #256, adding some logging rather than a crash, hoping to find out why
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant