Bug fix: Segfault during DnD
authorColin Clark <colin.clark@cclark.uk>
Thu, 24 Nov 2022 15:42:03 +0000 (15:42 +0000)
committerColin Clark <colin.clark@cclark.uk>
Thu, 24 Nov 2022 15:42:03 +0000 (15:42 +0000)
There will be a segfault when making a DnD from the files pane to the
folders pane if the image has an extremely high aspect ratio - when
rescaled to icon size the pixbuf width or height may round to 0.

src/dnd.cc

index ed7766c..f1e90b1 100644 (file)
@@ -133,8 +133,8 @@ void dnd_set_drag_icon(GtkWidget *widget, GdkDragContext *context, GdkPixbuf *pi
                h = sh * DND_ICON_SIZE / sw;
                }
 
-       dest = gdk_pixbuf_scale_simple(pixbuf, w, h, GDK_INTERP_BILINEAR);
-       pixbuf_draw_border(dest, w, h);
+       dest = gdk_pixbuf_scale_simple(pixbuf, MAX(1, w), MAX(1, h), GDK_INTERP_BILINEAR);
+       pixbuf_draw_border(dest, MAX(1, w), MAX(1, h));
 
        if (items > 1)
                {