Hotrian / OpenVRTwitchChat

Put your favorite Twitch Chat directly into any OpenVR game!
Other
173 stars 50 forks source link

App crashes on non-printable characters #29

Open bastixx opened 6 years ago

bastixx commented 6 years ago

I have found an possible error in the application. It seems to crash when it encounters a non printable character.

One of the bots on twitch "Stay_Hydrated_Bot" uses Control Characters in its message, which are non-printable. This crashes the app. Attached is the output_log.txt. I have removed all channel identifying information, as this is not my channel.

output_log_redacted.txt

Hotrian commented 6 years ago

Thanks! Seems to be an internal Unity issue. All I could do here is sanitize the text, but I'll see about doing so.

Hotrian commented 6 years ago

Any idea exactly what the characters are? Google doesn't seem to accept  or  (everything seems confused by these) :0

bastixx commented 6 years ago

Yea, they seem to be Control Characters. In this case specifically the SOH character, indicating an header. This is the only CC I have seen so far.

I have no clue why this bot sends this character, or why Twitch even passes these on, as they serve no purpose on twitch as far as i know..

Hotrian commented 6 years ago

Thanks! I realize now that I should have just checked them against any of the readily available ASCII converters. Hindsight and all that :). I should be able to sanitize them easily.

bastixx commented 6 years ago

Okay, good! Hoping that this will fix the crashes then :)

Hotrian commented 6 years ago

Could you try this new build? This one should strip all characters except Alphanumeric and the following list

{ ' ', '!', '"', '#', '$',
  '%', '&', '\'', '(', ')',
  '+', ',', '-', '.', '/',
  ':', ';', '=', '>', '?',
  '@', '[', '\\', ']', '^',
  '_', '`', '{', '|', '}', '~'};

This should be every character from 00100000 to 00111110

OpenVRTwitchChat-v1.0.7.5.zip

Hotrian commented 6 years ago

Btw, unfortunately I was unable to reproduce the issue. The exact text causing the issue

ACTION @ahyBottle You've been live for just over 1 hour. By this point in your broadcast you should have consumed at least 4oz (120mL) of water to maintain optimum hydration.

does not cause any errors for me in v1.0.7.4-test1. I also could not reproduce the issue with any of the control characters which I could reproduce in Twitch chat.

However, hopefully stripping the characters fixes the issue for you anyway.

bastixx commented 6 years ago

Hmm, weird.. But I asked the streamer to try out this new build, so we will know if this resolved the issue after his next VR stream :) I will report back if we encounter any issues!