Don't crash on very long inputs
authorManuel Nickschas <sputnick@quassel-irc.org>
Sat, 1 Mar 2014 13:07:36 +0000 (14:07 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sat, 1 Mar 2014 13:10:33 +0000 (14:10 +0100)
commit05c43ed7ab8eca002538670970cff4edb66f1011
treee8674d450ffb59497a534b023476c034b75c6ef9
parent52c52c972cb3909894d3eda4f2f1b44611b2fb3f
Don't crash on very long inputs

Because our style engine uses 16 bit indexes, strings can only be
styled if they're shorter than 2^16 characters. We do check for this
in the style engine and refuse to style strings that are longer.

However, just returning an default-constructed StyledString() is wrong,
because other places rely on there being at least one format and the
plaintext be initialized. So the proper way of handling this is just
using the baseFormat and the full string as plaintext instead of an
empty StyledString.

Fixes #1257.
src/uisupport/uistyle.cpp