Skip to content

Fix SGI 64-bit RGBA reading alpha from wrong buffer#328

Open
IfkumRfnl wants to merge 1 commit into
zigimg:masterfrom
IfkumRfnl:fix/sgi-rgba64-alpha-buffer
Open

Fix SGI 64-bit RGBA reading alpha from wrong buffer#328
IfkumRfnl wants to merge 1 commit into
zigimg:masterfrom
IfkumRfnl:fix/sgi-rgba64-alpha-buffer

Conversation

@IfkumRfnl

Copy link
Copy Markdown
Contributor

Summary

Fix bug where wrong buffer was used for alpha channel in SGI

Details

https://github.com/zigimg/zigimg/blob/master/src%2Fformats%2Fsgi.zig#L278

here code uses u16_buffer for reading r, g and b channels but uses buffer for alpha channel, seems like a typo

The .rgba64 path used u16_buffer for r, g and b but buffer (u8) for
the alpha channel, returning a truncated byte instead of the real
16-bit alpha. Other formats are unaffected.

Adds a test that constructs a 2x2 16-bit RGBA SGI file and asserts
all four alpha values; values chosen so the buggy u8 read fails
every assertion.
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.

1 participant