[Scummvm-git-logs] scummvm master -> 21f1e8f1bc1df3a8d955db2a2f5c44b37d4d2848
sev-
noreply at scummvm.org
Fri Aug 7 20:34:50 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
21f1e8f1bc GRAPHICS: MACGUI: Fix invalid rectangle when drawing tall scrolled text
Commit: 21f1e8f1bc1df3a8d955db2a2f5c44b37d4d2848
https://github.com/scummvm/scummvm/commit/21f1e8f1bc1df3a8d955db2a2f5c44b37d4d2848
Author: Ion Andrei Cristian (lecturatul2017 at gmail.com)
Date: 2026-08-07T22:34:47+02:00
Commit Message:
GRAPHICS: MACGUI: Fix invalid rectangle when drawing tall scrolled text
MacText::draw() passed _scrollPos + the canvas height as the height of the
drawn region, so drawStep() ended up computing y + h = 2 * _scrollPos +
canvas height. drawStep() then built the background fill in the source
coordinates instead of the destination ones, and without the clamping the
blits below it use, so with enough scrollback the rectangle overflowed the
16 bit Common::Rect and aborted on isValidRect(). It was reproducible in
MacVenture, whose output console keeps the whole session scrollback: the
game crashed once the console passed about 680 lines.
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 079150e2527..798fd469d76 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -938,8 +938,14 @@ void MacText::removeLastLine() {
}
void MacText::drawStep(ManagedSurface *g, ManagedSurface *src, ManagedSurface *border, int x, int y, int w, int h, int xoff, int yoff, uint32 tcolor, uint32 btcolor) {
- if (x + w < src->w || y + h < src->h)
- g->fillRect(Common::Rect(x + xoff, y + yoff, x + w + xoff, y + h + yoff), tcolor);
+ // The fill covers the destination area the blits below write to, so it has
+ // to be expressed in destination coordinates and clipped to the surface:
+ // Common::Rect is 16 bit and asserts in its constructor, before any clipping
+ int fillRight = MIN<int>(xoff + w, g->w);
+ int fillBottom = MIN<int>(yoff + h, g->h);
+
+ if ((x + w < src->w || y + h < src->h) && xoff < fillRight && yoff < fillBottom)
+ g->fillRect(Common::Rect(xoff, yoff, fillRight, fillBottom), tcolor);
// blit shadow surface first
if (_canvas._textShadow)
@@ -1061,7 +1067,7 @@ bool MacText::draw(bool forceRedraw) {
if (!(_contentIsDirty || forceRedraw))
return true;
- draw(_composeSurface, 0, _scrollPos, _canvas._surface->w, _scrollPos + _canvas._surface->h, offset.x, offset.y);
+ draw(_composeSurface, 0, _scrollPos, _canvas._surface->w, _canvas._surface->h, offset.x, offset.y);
for (int bb = 0; bb < _shadow; bb++) {
_composeSurface->hLine(_shadow, _composeSurface->h - _shadow + bb, _composeSurface->w, 0);
More information about the Scummvm-git-logs
mailing list