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

an escape sequence broken across multiple read()'s is not handled quite right #2852

Open
tstack opened this issue Feb 3, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@tstack
Copy link

tstack commented Feb 3, 2025

I think the last change for #2647 is causing problems when I'm testing with WSL/Windows Terminal.

I'm working with Windows 11 24H2 and installed Ubuntu 24.04 WSL. Using Windows Terminal, I start a shell in ubuntu and run my program. Sometimes it works and other times it stalls out. Tracing things through, the DA1 response is getting split across two read() calls. The first call returns 16 bytes with \e[?61;6;7;14;21;. Since the c terminator did not come through, process_escape() returns with -16 and midescape set to 1. But, then process_melange() hits the || *bufused == origlencondition and clears themidescape` and the bytes there are treated as regular input. Since the DA1 response never comes through, initialization stalls out.

The relevant change:

c888217#diff-b7dbcafb0f8345e04cd585f962cdc2d12c9e79b68e13fe6099aeece3b785ce2bL2300-R2301

@tstack tstack added the bug Something isn't working label Feb 3, 2025
@tstack
Copy link
Author

tstack commented Feb 4, 2025

Oops, I forgot to mention that when this occurs, the following assert is raised (don't pay attention to line number, it's in my customized version):

Assertion failed: ictx->amata.used <= buflen (../../../../../../src/third-party/notcurses/src/lib/in.c: process_escape: 2219)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant