[pdfmod] Fix crash on page click due to ExportImagesAction (bgo#631889)
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pdfmod] Fix crash on page click due to ExportImagesAction (bgo#631889)
- Date: Thu, 3 Mar 2011 17:47:28 +0000 (UTC)
commit 7601244cf5253ae42797c01d60b8b6ebc65c9820
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu Mar 3 11:43:25 2011 -0600
Fix crash on page click due to ExportImagesAction (bgo#631889)
If the /Filter of an image is an array, say [/FlateDecode, /DctDecode]
we would crash, since we were expecting just one of those. We now
ignore such images (still only handling PNG and JPEG files).
src/PdfMod/Pdf/Actions/ExportImagesAction.cs | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/PdfMod/Pdf/Actions/ExportImagesAction.cs b/src/PdfMod/Pdf/Actions/ExportImagesAction.cs
index ff45dbf..8363b2d 100644
--- a/src/PdfMod/Pdf/Actions/ExportImagesAction.cs
+++ b/src/PdfMod/Pdf/Actions/ExportImagesAction.cs
@@ -104,7 +104,8 @@ namespace PdfMod.Pdf.Actions
bool IsExportable (ImageInfo image)
{
- var filter = image.ImageObject.Elements.GetName("/Filter");
+ var filter_obj = image.ImageObject.Elements["/Filter"];
+ var filter = filter_obj == null ? "" : filter_obj.ToString ();
return filter == "/DCTDecode" || filter == "/FlateDecode";
}
@@ -113,7 +114,8 @@ namespace PdfMod.Pdf.Actions
/// </summary>
void Export (ImageInfo image, string to_path)
{
- string filter = image.ImageObject.Elements.GetName("/Filter");
+ var filter_obj = image.ImageObject.Elements["/Filter"];
+ var filter = filter_obj == null ? "" : filter_obj.ToString ();
switch (filter) {
case "/DCTDecode":
ExportJpegImage (image, GetFilename (image, to_path, "jpg"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]