UWP: Add a missing bounds check from TextDrawerWin32::DrawStringBitmap

Fixes a crash on switching tabs
This commit is contained in:
Silent 2021-06-27 17:55:42 +02:00
parent bb38cf842b
commit c4572afdb1
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1

View file

@ -359,6 +359,11 @@ void TextDrawerUWP::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStrin
size.cx = metrics.width + 1;
size.cy = metrics.height + 1;
if (size.cx > MAX_TEXT_WIDTH)
size.cx = MAX_TEXT_WIDTH;
if (size.cy > MAX_TEXT_HEIGHT)
size.cy = MAX_TEXT_HEIGHT;
// Prevent zero-sized textures, which can occur. Not worth to avoid
// creating the texture altogether in this case. One example is a string
// containing only '\r\n', see issue #10764.