Commit b0cc27c3 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Some more fixed to prevent segfaults with missing or nonsensical ranges.

2007-09-21  Matthias Clasen <mclasen@redhat.com>

        * gtk/gtkprintoperation.c (print_pages_idle): Some more
        fixed to prevent segfaults with missing or nonsensical ranges.


svn path=/trunk/; revision=18854
parent e7131b2f
2007-09-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintoperation.c (print_pages_idle): Some more
fixed to prevent segfaults with missing or nonsensical ranges.
2007-09-21 Jean Brefort <jean.brefort@normalesup.org>
* gtk/gtkprintoperation.c: (print_pages_idle): abort printing
......
......@@ -2090,23 +2090,21 @@ print_pages_idle (gpointer user_data)
goto out;
}
/* FIXME handle this better */
if (priv->nr_of_pages == 0)
g_warning ("no pages to print");
/* Initialize parts of PrintPagesData that depend on nr_of_pages
*/
if (priv->print_pages == GTK_PRINT_PAGES_RANGES)
{
if (priv->page_ranges == NULL) {
g_warning ("no pages to print");
priv->cancelled = TRUE;
goto out;
if (priv->page_ranges == NULL)
{
g_warning ("no pages to print");
priv->cancelled = TRUE;
goto out;
}
data->ranges = priv->page_ranges;
data->num_ranges = priv->num_page_ranges;
for (i = 0; i < data->num_ranges; i++)
if (data->ranges[i].end == -1)
if (data->ranges[i].end == -1 ||
data->ranges[i].end >= priv->nr_of_pages)
data->ranges[i].end = priv->nr_of_pages - 1;
}
else if (priv->print_pages == GTK_PRINT_PAGES_CURRENT &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment