Skip to content

Commit

Permalink
notifications: fix error in parseImageData on invalid pixbuf (Aylur#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski authored and gorsbart committed Feb 28, 2024
1 parent 79b3788 commit ea3cc12
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/service/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,18 @@ export class Notification extends Service {
const [w, h, rs, alpha, bps, _, data] = imageData // iiibiiay
.recursiveUnpack<[number, number, number, boolean, number, number, GLib.Bytes]>();

if (bps !== 8) {
console.warn(`Notification image error from ${this.app_name}: ` +
'Currently only RGB images with 8 bits per sample are supported.');
return null;
}

const pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(
data, GdkPixbuf.Colorspace.RGB, alpha, bps, w, h, rs);

if (!pixbuf)
return null;

const outputStream = Gio.File.new_for_path(fileName)
.replace(null, false, Gio.FileCreateFlags.NONE, null);

Expand Down

0 comments on commit ea3cc12

Please sign in to comment.