Repository navigation
Conversation
Validate image-data dimensions, rowstride, and byte length in DBusNotificationImage::operator>> and clear the pixmap on failure so Notification::updateProperties falls back to image-path instead of exposing an invalid image URL. Store and pass the client's rowstride to QImage::QImage(..., bytesPerLine, format) instead of letting QImage assume 32-bit aligned rows. Pad multi-row buffers whose final row omits trailing rowstride padding (permitted by GdkPixbuf / the notification spec) so QImage deep copies do not read past the buffer, and pass the exact row width for single-row images. Check buffer bounds in createImage() as well and clear the pixmap before demarshalling so malformed arguments cannot retain stale data.
leierx
marked this pull request as ready for review
November 25, 2026 13:59
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.
Describe your changes
Any app on the session bus can send
image-datahints over D-Bus, so Quickshell should not trust the claimed width, height, or rowstride without checking the actual byte buffer.Right now:
operator>>warns on badsampleBits,channels, orrowstride, but keeps the pixmap anyway and never checkswidth,height, ordata.size(). A singleNotifycall claiming a large size (like65535x65535) with 16 bytes of data crashes the shell whenQImagereads past the buffer.createImage()ignoresrowstride, so Qt assumes 32-bit aligned rows and misrenders padded rowstrides or unalignedRGB888buffers.Notification::updateProperties()still setsimagePathto the pixmap URL whenimage-datafails to parse, so it does not fall back toimage-path.Details and decisions
pixmapbefore parsing and on any failed check (sampleBits,channels,width <= 0,height <= 0,rowstride < minRowBytes, ordata.size() < minBytes), usingqint64sowidth * channelscannot overflow.rowstrideonDBusNotificationImage, pass it asbytesPerLinetoQImage, and re-check bounds increateImage().GdkPixbufallows omitting padding after the last row (rowstride * (height - 1) + width * channels), whileQImage::copy()readsbytesPerLine * heightbytes. Forheight == 1, passminRowBytes; forheight > 1, zero-pad the buffer torowstride * height(with an overflow check).imagePath = mImagePixmap.url()ifmImagePixmap.hasData()is true, so invalidimage-datafalls back toimage-path.Tested on my NixOS setup using this patch against 0.3.2 (including tests sending
100x100and65535x65535with 16-byte buffers), plus local Qt 6.12 compile and harness checks on this branch.Open concerns
None.
Participation
I used Gemini Neon and Claude Opus 5.5 to find this issue (through chaos testing my shell) and write the fix. I understand the code on a surface level, I am no C++ or Qt expert, but the approach looks reasonable to me and I am very open to being corrected.