Fixed a potential segfault in the text renderer

This commit is contained in:
Matthias Koefferlein 2024-08-03 22:23:48 +02:00
parent 3290d0ab21
commit 40e360e640
1 changed files with 6 additions and 8 deletions

View File

@ -293,16 +293,14 @@ Bitmap::fill_pattern (int y, int x, const uint32_t *pp, unsigned int stride, uns
while (n > 0 && y >= 0) { while (n > 0 && y >= 0) {
for (unsigned int s = 0; s < stride; ++s) { for (unsigned int s = 0; s < stride; ++s, pp++) {
uint32_t p = *pp;
int x1 = x + s * 32; int x1 = x + s * 32;
if (x1 <= -32 || x1 >= m_width) {
uint32_t p = *pp++; continue;
} else if (x1 < 0) {
if (x1 < 0) {
if (x1 <= -32) {
return;
}
p >>= (unsigned int)-x1; p >>= (unsigned int)-x1;
x1 = 0; x1 = 0;
} }