DiscordMessenger / dm

Discord Messenger is a free Discord-compatible messaging client targeting both new and old Windows.
MIT License
813 stars 13 forks source link

Discord Messenger crashes because of `Access violation` (out-of-bound access) if message is a single `@` #116

Closed BadAimWeeb closed 1 week ago

BadAimWeeb commented 3 weeks ago

Tested on version 1.06, MSVC build.

https://github.com/DiscordMessenger/dm/blob/53951a09061b04836d61589815761142891d6c89/src/discord/FormattedText.cpp#L745

image image

Not sure why it crashed since the for loop LGTM, maybe bad optimization?

iProgramMC commented 3 weeks ago

Not sure why it crashed since the for loop LGTM, maybe bad optimization?

Because size_t is unsigned, so str.size()-2 has the chance to overflow. Oops, I'll fix it