Repository navigation
tray: accept BMP icons whose declared size is bounded - #5527
Open
ShrimpTale wants to merge 1 commit into
Open
ShrimpTale wants to merge 1 commit into
ShrimpTale wants to merge 1 commit into
Conversation
SDL's tray support wrote the icon as a temporary BMP for libayatana-appindicator before SDL 3.4, and other toolkits still do. Those items rendered as image-missing on waybar 0.15.0-3 -> 0.16.0 (their IconName is a file waybar refused to decode). Keep the existing bound instead of relaxing it: BMP states its size in the DIB header, so the pixel limit is checked before anything is decoded, exactly like the PNG path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Tray items whose
IconNameis a BMP file are decoded again, bounded by the sameMAX_ICON_FILE_PIXELSlimit that already applies to PNG.Since 0.16.0
loadIconFromFile()only accepts PNG and SVG, so those items fall back toimage-missingand log:0.15.x decoded whatever the item named with
Gdk::Pixbuf::create_from_file(), so this is aregression for any SDL application with a tray icon. SDL's tray support wrote the icon as a
temporary BMP for libayatana-appindicator until 3.4 (
SDL_SaveBMP()insrc/tray/unix/SDL_tray.c); SDL 3.4 switched to PNG, but applications built against older SDL —and other toolkits that still write BMP — keep handing out
.bmppaths.Concrete case: BongoCat 1.12.0 (SDL 3.2.31) on Arch with waybar 0.16.0 and the Papirus icon
theme. It is reachable today with
tray.iconsand a manual mapping, but that needs one entry perapplication, keyed by an item ID that can contain the PID (
sdl-appindicator-1987-0), for anapplication the user does not control.
Why this keeps the bound
The existing check exists so that nothing is decoded before its declared size is known. A BMP
declares
biWidth/biHeightin its DIB header, so the same bound runs beforecreate_from_stream_at_scale(). The file is still read through the opened descriptor, stillcapped at 64 MiB, and still decoded at bar height.
Related issues
No tracking issue — happy to open one first if you would rather review it there.
Checklist
clang-format(23.1.5, repo.clang-format)meson setup build && ninja -C build→ 350/350)20000×20000 header is refused, negative (top-down)
biHeightis handled