From 076f52594df5e68bf9806b4b69e915350b3c9319 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Mon, 21 Apr 2014 12:15:04 +0200 Subject: create_thumbnail_frame should return NULL when source_pixbuf is NULL and width and height are not positive. fix https://bugzilla.redhat.com/show_bug.cgi?id=1082143 taken from https://git.gnome.org/browse/evince/commit/?id=3d8180a605e8c98172e9e0e739e22b7f50ed7bad --- libdocument/ev-document-misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c index d597127f..6099b7fa 100644 --- a/libdocument/ev-document-misc.c +++ b/libdocument/ev-document-misc.c @@ -56,7 +56,7 @@ create_thumbnail_frame (int width, } /* make sure no one is passing us garbage */ - g_assert (width_r >= 0 && height_r >= 0); + g_return_val_if_fail (width_r >= 0 && height_r >= 0, NULL); retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, -- cgit v1.2.1 From bc94b296158e036be054c5ed061af83c893f1ea9 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Mon, 21 Apr 2014 12:18:15 +0200 Subject: ps: Make sure page labels are valid utf-8 strings taken from https://git.gnome.org/browse/evince/commit/?id=150d0cfa2d8f64823f2782d207d717fa3ac340a0 --- backend/ps/ev-spectre.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/backend/ps/ev-spectre.c b/backend/ps/ev-spectre.c index d28325ba..b0489b78 100644 --- a/backend/ps/ev-spectre.c +++ b/backend/ps/ev-spectre.c @@ -224,7 +224,21 @@ static char * ps_document_get_page_label (EvDocument *document, EvPage *page) { - return g_strdup (spectre_page_get_label ((SpectrePage *)page->backend_page)); + const gchar *label = spectre_page_get_label ((SpectrePage *)page->backend_page); + gchar *utf8; + + if (!label) + return NULL; + + if (g_utf8_validate (label, -1, NULL)) + return g_strdup (label); + + /* Try with latin1 and ASCII encondings */ + utf8 = g_convert (label, -1, "utf-8", "latin1", NULL, NULL, NULL); + if (!utf8) + utf8 = g_convert (label, -1, "utf-8", "ASCII", NULL, NULL, NULL); + + return utf8; } static EvDocumentInfo * -- cgit v1.2.1