Ticket #540 (Fixed)Tue Dec 21 00:55:09 UTC 2021
OS_SpriteOp 38 Create/remove Alpha Overflows the Sprite Area
Reported by: | Andy S (2979) | Severity: | Major |
Part: | RISC OS: Module | Release: | |
Milestone: | Status | Fixed |
Details by Andy S (2979):
When using OS_SpriteOp 38 – Create/remove Alpha to add an alpha mask to a sprite, SpriteExtend seems to sometimes write past the end of the sprite area, despite making sure enough space has been reserved (I checked the calculation and even compared the sizes of sprite files with and without alpha masks to make sure).
I tracked it down to this code: https://gitlab.riscosopen.org/RiscOS/Sources/Vi…
The bug seems to be that the amount to grow the mask, given in R0, gets added to R10 twice (once just before the call to move_memory_up, and once inside that routine) when it should only be done once by move_memory_up.
Note that conversion to an on/off mask seems to be affected by the same, or a very similar, problem as well. I’ve not had time to see if it crops up anywhere else.
Full details with a BASIC repro, crash dump and analysis of the ASM here: https://www.riscosopen.org/forum/forums/4/topic…
If this bug is fixed in a future version of SpriteExtend, its version number will need putting into the RMEnsure statement in the function psprite_need_convertalpha_fix() in Paint. This determines whether to enable workarounds in Paint to reserve extra space in the sprite area when using Create/remove Alpha.
Changelog:
Modified by Jeffrey Lee (213) Mon, October 03 2022 - 16:46:36 GMT
- Status changed from Open to Fixed
This should now be fixed with SpriteExtend 1.86
https://gitlab.riscosopen.org/RiscOS/Sources/Vi…
Thanks for tracking down where the problem was, an apologies for taking so long to fix it!