Closed Bug 1282419 Opened 8 years ago Closed 7 years ago

Large libnotify alert images trigger a SIGTERM


(Toolkit Graveyard :: Notifications and Alerts, defect, P1)



(firefox59 fixed)

Tracking Status
firefox59 --- fixed


(Reporter: lina, Assigned: agashlin)




(1 file)


1. Open
2. Select "Huge icon (PNG, 3333x5230)" from the "Icon" drop-down menu.
3. Click "Display the notification."

The GDB backtrace shows a call to `notify_notification_show`, so we at least make it that far.
I can still reproduce it on GNOME version 3.24.2 with Firefox 55.

Test site:
See some more info in bug 1395940.
Priority: -- → P1
See Also: → 1372819
I see that we're always decoding the image to its native size [1].

This seems to be getting stuck in dbus-daemon: when we send a large enough image it rejects it as out of spec (see [2] and [3]), then Firefox halts on the broken connection [4], because glib dbus connections default to exit on close. The notification example is 66.5 MB of RGBA, DBUS_MAXIMUM_ARRAY_LENGTH is 64 MB.

We should probably resize the image if it is going to go over the limit.

It may be a bug for glib to be sending arrays this large as the dbus documentation is pretty clear about the size limit [5].

(At least this what I found through testing on Lubuntu 17.10, I didn't see notify_notification_show explicitly in the backtrace so I may be looking at a different issue?)

Resizing turned out to be more of an ordeal than I expected. In the interest of getting this fixed now, here's a patch that prevents us from sending such large images.

The size limit isn't exactly 64MB because the image data array is wrapped in the hints array, which has the same limit. I added a bit of fudge beyond the 60 bytes that are definitely needed by libnotify. Fortunately we don't set any other hints so there aren't known variable sizes to take into consideration, but parts of the message depend on the protocol.
Assignee: nobody → agashlin
Attachment #8932682 - Flags: review?(karlt)
Comment on attachment 8932682 [details] [diff] [review]
Don't attempt to notify with a large icon

Thank you for the analysis.

If not pushing future patches to reviewboard, then please update ~/.hgrc to
include more context in patches by default.  This might be the relevant

git = true
showfunc = 1
unified = 8
Attachment #8932682 - Flags: review?(karlt) → review+
Thanks karlt, and sorry about the ugly patch, I'll make those changes and try to remember reviewboard next time.

Try looks ok.
Keywords: checkin-needed
Pushed by
Don't send a large notify image. r=karlt
Keywords: checkin-needed
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.