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

SDL_LoadBMP: wrong handling of BMP images that have BI_BITFILEDS compression #1457

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.1
Reported for operating system, platform: All, All

Comments on the original bug report:

On 2014-04-27 09:06:31 +0000, wrote:

There is a bug in SDL_LoadBMP when loading a BMP with BI_BITFIELDS compression.

The bug was introduced in:
http://hg.libsdl.org/SDL/rev/44dc7926f62d

The problem is that the SDL_RWseek on src file is called before
[ARGB]mask for BI_BITFILEDS is read and wrong values end up in
[ARGB]mask variables.

On 2014-10-10 09:18:37 +0000, Rudolf Polzer wrote:

I was just tracking down the same problem.

The issue is that the RGBA masks are actually part of struct BITMAPV4HEADER, and thus follow directly the biClrUsed value, instead of being behind the bitmap header struct.

However, the commit is correct for palette images - for these, the color table indeed follows the whole header.

As a solution, I suggest skipping over the whole header size AFTER reading the masks (if used). This will fix support for BMP formats v4 (since Win95) and v5 (since Win98).

On 2014-10-11 07:01:35 +0000, Sam Lantinga wrote:

Can you try the latest snapshot?
http://www.libsdl.org/tmp/SDL-2.0.zip

Thanks!

On 2014-10-13 08:47:47 +0000, Rudolf Polzer wrote:

Although I didn't get to checking it yet, I believe the change https://hg.libsdl.org/SDL/rev/08f3b56969b1 must fix the issue.

On 2015-02-19 02:32:05 +0000, Ryan C. Gordon wrote:

(In reply to Rudolf Polzer from comment # 3)

Although I didn't get to checking it yet, I believe the change
https://hg.libsdl.org/SDL/rev/08f3b56969b1 must fix the issue.

Yes, that changeset should fix this specific issue.

--ryan.

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

No branches or pull requests

1 participant