Tiling causes a crash when area has negative dimensions

Issue #340 resolved
Former user created an issue

Automatic migration. Original reporter: "Timo"

v0-7 branch (revision 2464)

If there's a FrameComponent/ImageComponent with <HorzFormat type="Tiled"/> or <VertFormat type="Tiled"/>, and the corresponding dimension of the StateImagery area becomes negative, this will cause a crash (std::bad_alloc).

The problem occurs because the tile count variable wraps around:

horzTiles = (uint)((destRect.getWidth() + (imgSz.d_width - 1)) / imgSz.d_width);

Reproducibility: always

Comments (2)

  1. Paul Turner

    Fixed in branches/v0-7 @ r2468.

    The fix resolves the crash, but does not reverse the direction of the tiling (or swap the edges to be correct) - so under these circumstances all the copies of the tiled image get clipped.

    If you think the image should be drawn under these conditions, feel free to raise a request; though it may not get serviced as quickly as a crash-bug ;)

  2. Log in to comment