Skip to content

Teach ConvertSpriteToPngCommand to handle frames that extend outside FrameSize.#21582

Merged
Mailaender merged 1 commit into
OpenRA:bleedfrom
RoosterDragon:fix-png-export
Sep 15, 2024
Merged

Teach ConvertSpriteToPngCommand to handle frames that extend outside FrameSize.#21582
Mailaender merged 1 commit into
OpenRA:bleedfrom
RoosterDragon:fix-png-export

Conversation

@RoosterDragon
Copy link
Copy Markdown
Member

The rectangle defined by a frames's Offset+Size usually fits within the rectangle given by FrameSize. However it can sometimes extend outside this region due to padding added by the engine. This causes an array-out-of-bounds crash as we only allocate space to cover the FrameSize region.

Now, we teach the copying process to only copy the portion of the data that lies within the FrameSize region. If any data extends outside the region, it won't be copied.

Fixes #21536

…FrameSize.

The rectangle defined by a frames's Offset+Size usually fits within the rectangle given by FrameSize. However it can sometimes extend outside this region due to padding added by the engine. This causes an array-out-of-bounds crash as we only allocate space to cover the FrameSize region.

Now, we teach the copying process to only copy the portion of the data that lies within the FrameSize region. If any data extends outside the region, it won't be copied.
Copy link
Copy Markdown
Member

@Mailaender Mailaender left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as promised.

@Mailaender Mailaender merged commit b3b82b9 into OpenRA:bleed Sep 15, 2024
@Mailaender
Copy link
Copy Markdown
Member

Changelog

@RoosterDragon RoosterDragon deleted the fix-png-export branch September 15, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Offset and length were out of bounds on utility --png

2 participants