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

Hard crash entering ctrl-^ then . then enter into blink> prompt #1994

Open
fingolfin opened this issue Mar 18, 2024 · 6 comments
Open

Hard crash entering ctrl-^ then . then enter into blink> prompt #1994

fingolfin opened this issue Mar 18, 2024 · 6 comments
Labels
bug Bug that's either related to Blink Shell or prevents the user to use the app in normal conditions.

Comments

@fingolfin
Copy link

fingolfin commented Mar 18, 2024

To exit a hanging mosh session, one should enter ctrl-^ . On my keyboard that is ctrl-shift-6 then . -- for various reasons I am in the habit of pressing enter after this, then repeating this 1-2 times (to deal with various lag issues etc.).

That lead me to discover that if I am on the blink> prompt and do this there (ctrl-^ then . then enter) it crashes Blink hard -- it just is dead, and reopening it afterwards various sessions I had closed magically re-appear (broken). In fact it seems all my connections are broken after this hard crash.

Actually I just tried, and just ctrl-6 followed by enter (or return) also triggers the crash.

This is with v17.2.2.868 on iOS 17.4 on an iPad Pro (11 inch, 3rd gen)

@fingolfin fingolfin added the bug Bug that's either related to Blink Shell or prevents the user to use the app in normal conditions. label Mar 18, 2024
@carloscabanero
Copy link
Member

That's an interesting one. Will take a look at what may be provoking the crash.

@l2dy
Copy link
Contributor

l2dy commented Mar 20, 2024

I thought people won't type weird things and closed #1900. I was wrong.

Screenshot 2024-03-20

Edit: #1900 is not actually relevant, because this is valid UTF-8. The correspondence comes from "weird things typed".

@fingolfin
Copy link
Author

Well I did not really input it intentionally, it just happened ;-). Still would be good if that didn't cause a hard crash

@l2dy
Copy link
Contributor

l2dy commented Mar 20, 2024

No worries. I didn't mean to be harsh about this. I hold the same opinion that a crash or freeze should not happen.

This crash happens inside ios_system and I can reproduce it in a-shell too. I'm having a hard time getting Address Sanitizer to work inside ios_system, but there is some progress.

@l2dy
Copy link
Contributor

l2dy commented Mar 20, 2024

Passing the string 1E 00 (Ctrl-^) to getLastCharacterOfArgument() returns an invalid pointer 0x1. This needs to be fixed upstream.

Screenshot 2024-03-21

P.S. Address Sanitizer was not needed for this.

@l2dy
Copy link
Contributor

l2dy commented Mar 22, 2024

@carloscabanero I have a patch for it. It's very unfortunate that ios_system uses ^^ as its internal Record Separator for arguments with both ' and ". The internal ^^ always comes in pairs, except when you put one in the input ;)

diff --git a/ios_system.m b/ios_system.m
index 21e9eeb..87a498b 100644
--- a/ios_system.m
+++ b/ios_system.m
@@ -2459,6 +2459,7 @@ static char* getLastCharacterOfArgument(const char* argument) {
         return NULL;
     } else if (argument[0] == recordSeparator) {
         char* endquote = strchr(argument + 1, recordSeparator);
+        if (endquote == NULL) return NULL; // be safe
         return endquote + 1;
     }
     // TODO: the last character of the argument could also be '<' or '>' (vim does that, with no space after file name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that's either related to Blink Shell or prevents the user to use the app in normal conditions.
Projects
None yet
Development

No branches or pull requests

3 participants