Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect bfOffBits Calculation in WIN_ConvertDIBtoBMP #12315

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

thouravi
Copy link
Contributor

Description

In WIN_ConvertDIBtoBMP, the code incorrectly uses sizeof(BITMAPINFOHEADER) instead of pbih->biSize to calculate the offset to pixel data in the BMP header. This leads to invalid BMP files when the DIB uses a header larger than BITMAPINFOHEADER.

Solution

Replaced sizeof(BITMAPINFOHEADER) with pbih->biSize as it represents the actual size of the DIB header (e.g., 40, 108 bytes), ensuring the correct offset to pixel data.

@slouken slouken merged commit 5c79f4c into libsdl-org:main Feb 17, 2025
41 checks passed
@slouken
Copy link
Collaborator

slouken commented Feb 17, 2025

Merged, thanks!

@thouravi thouravi deleted the patch-1 branch February 17, 2025 21:59
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.

2 participants