[Scummvm-devel] simon1 windows - 64 bit segfault
Max Horn
max at quendi.de
Mon Aug 20 22:17:24 CEST 2007
Am 19.08.2007 um 23:48 schrieb Mark Weaver:
> The attached patch fixes a segfault on x86_64 on entering the room
> with the blacksmith (from start, out of cottage, right) in Simon
> the Sorcerer 1 (CD/Windows/English).
>
> Basically x is negative there, so cast to a uint this is a large
> value. On ia32 when added to getBackground() this will overflow
> and become a valid pointer again (I believe, not tested), on x86_64
> it does not overflow and so segfaults when dereferencing the
> pointer. I have fixed this simply by using a signed int for xoffs/
> yoffs, which promotes correctly.
> Index: draw.cpp
> ===================================================================
> --- draw.cpp (revision 28664)
> +++ draw.cpp (working copy)
> @@ -503,8 +503,8 @@
> if (_window3Flag == 1) {
> animTable->srcPtr = (const byte *)_window4BackScn;
> } else {
> - uint xoffs = (_videoWindows[vsp->windowNum * 4 + 0] * 2 + x) * 8;
> - uint yoffs = (_videoWindows[vsp->windowNum * 4 + 1] + y);
> + int xoffs = (_videoWindows[vsp->windowNum * 4 + 0] * 2 + x) * 8;
> + int yoffs = (_videoWindows[vsp->windowNum * 4 + 1] + y);
> animTable->srcPtr = getBackGround() + xoffs + yoffs * _screenWidth;
> }
>
Great, sounds reasonable. Does this by chance fix bug #1769644?
(https://sourceforge.net/tracker/index.php?
func=detail&aid=1769644&group_id=37116&atid=418820)
Cheers,
Max
More information about the Scummvm-devel
mailing list