diff options
author | Matthias Clasen <mclasen@redhat.com> | 2007-09-21 15:38:29 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2007-09-21 15:38:29 +0000 |
commit | b0cc27c30b047aaf3e46d01b1ff21d39a3742c88 (patch) | |
tree | e36b4c9aad8dcc924485a1e6da723bdd2f18c07d /gtk | |
parent | e7131b2f919ee4f33181b1d7b80a23e75dcbef14 (diff) | |
download | gdk-pixbuf-b0cc27c30b047aaf3e46d01b1ff21d39a3742c88.tar.gz |
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
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkprintoperation.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c index 1c3a1901f..4519cd24f 100644 --- a/gtk/gtkprintoperation.c +++ b/gtk/gtkprintoperation.c @@ -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 && |