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 when processing incorrectly formatted OSC wildcards #10

Closed
Daniel-Higgott opened this issue Sep 30, 2023 · 0 comments · Fixed by #12
Closed

Crash when processing incorrectly formatted OSC wildcards #10

Daniel-Higgott opened this issue Sep 30, 2023 · 0 comments · Fixed by #12

Comments

@Daniel-Higgott
Copy link

If an OSCMethod attempts to match an OSC Address containing an incorrectly formatted square bracketed wildcard, OSCKit crashes. Specifically, the formatting needs to include whitespace to create this crash. For example:

/this/example/[0- 1]/would/crash/OSCKit

/this/example/[0-1]/would/not

The crash occurs within OSCMatch, function:

func matchSquareBracket(pattern: String,
patternCharacterOffset: inout String.Index,
address: String,
addressCharacterOffset: inout String.Index) -> Bool

Thread 1: Fatal error: String index is out of bounds

It would be great if the match could fail silently, rather than throw an exception. I guess you could perform a check for invalid characters on the way in? Or break the While loop before the index is out of bounds...

I'm on the Issue sammysmallman/OSCKit#23 branch, if that makes any difference.

Thanks again for all your work on OSCKit, I especially love the easy pattern matching, when it's not crashing!

@sammysmallman sammysmallman transferred this issue from sammysmallman/OSCKit Sep 30, 2023
@sammysmallman sammysmallman mentioned this issue Oct 2, 2023
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

Successfully merging a pull request may close this issue.

1 participant