diff --git a/Common/Render/Text/draw_text_uwp.cpp b/Common/Render/Text/draw_text_uwp.cpp index 6f5088619f..d12a41275f 100644 --- a/Common/Render/Text/draw_text_uwp.cpp +++ b/Common/Render/Text/draw_text_uwp.cpp @@ -359,6 +359,11 @@ void TextDrawerUWP::DrawStringBitmap(std::vector &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.