poppler/Annot.cc | 7 ++++--- poppler/Link.cc | 30 +++++++++++++++++------------- poppler/Sound.cc | 8 +++++--- 3 files changed, 26 insertions(+), 19 deletions(-)
New commits: commit 6ef83414ab55294cf46b6b05813927bb04066986 Author: Albert Astals Cid <[email protected]> Date: Tue Jun 30 23:07:00 2009 +0200 Check getFileSpecNameForPlatform succeeded before using it's return value Fixes crash on bug 22551 diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 4bba3b5..99c3731 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -3528,9 +3528,10 @@ void AnnotMovie::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) { if (dict->lookup("Movie", &movieDict)->isDict()) { Object obj2; - getFileSpecNameForPlatform(movieDict.dictLookup("F", &obj1), &obj2); - fileName = obj2.getString()->copy(); - obj2.free(); + if (getFileSpecNameForPlatform(movieDict.dictLookup("F", &obj1), &obj2)) { + fileName = obj2.getString()->copy(); + obj2.free(); + } obj1.free(); if (movieDict.dictLookup("Aspect", &obj1)->isArray()) { diff --git a/poppler/Link.cc b/poppler/Link.cc index 61f05b7..7cb7aeb 100644 --- a/poppler/Link.cc +++ b/poppler/Link.cc @@ -16,7 +16,7 @@ // Copyright (C) 2006, 2008 Pino Toscano <[email protected]> // Copyright (C) 2007 Carlos Garcia Campos <[email protected]> // Copyright (C) 2008 Hugo Mercier <[email protected]> -// Copyright (C) 2008 Albert Astals Cid <[email protected]> +// Copyright (C) 2008, 2009 Albert Astals Cid <[email protected]> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -423,9 +423,10 @@ LinkGoToR::LinkGoToR(Object *fileSpecObj, Object *destObj) { // get file name Object obj1; - getFileSpecNameForPlatform (fileSpecObj, &obj1); - fileName = obj1.getString()->copy(); - obj1.free(); + if (getFileSpecNameForPlatform (fileSpecObj, &obj1)) { + fileName = obj1.getString()->copy(); + obj1.free(); + } // named destination if (destObj->isName()) { @@ -469,17 +470,19 @@ LinkLaunch::LinkLaunch(Object *actionObj) { if (actionObj->isDict()) { if (!actionObj->dictLookup("F", &obj1)->isNull()) { - getFileSpecNameForPlatform (&obj1, &obj3); - fileName = obj3.getString()->copy(); - obj3.free(); + if (getFileSpecNameForPlatform (&obj1, &obj3)) { + fileName = obj3.getString()->copy(); + obj3.free(); + } } else { obj1.free(); #ifdef WIN32 if (actionObj->dictLookup("Win", &obj1)->isDict()) { obj1.dictLookup("F", &obj2); - getFileSpecNameForPlatform (&obj2, &obj3); - fileName = obj3.getString()->copy(); - obj3.free(); + if (getFileSpecNameForPlatform (&obj2, &obj3)) { + fileName = obj3.getString()->copy(); + obj3.free(); + } obj2.free(); if (obj1.dictLookup("P", &obj2)->isString()) { params = obj2.getString()->copy(); @@ -493,9 +496,10 @@ LinkLaunch::LinkLaunch(Object *actionObj) { //~ just like the Win dictionary until they say otherwise. if (actionObj->dictLookup("Unix", &obj1)->isDict()) { obj1.dictLookup("F", &obj2); - getFileSpecNameForPlatform (&obj2, &obj3); - fileName = obj3.getString()->copy(); - obj3.free(); + if (getFileSpecNameForPlatform (&obj2, &obj3)) { + fileName = obj3.getString()->copy(); + obj3.free(); + } obj2.free(); if (obj1.dictLookup("P", &obj2)->isString()) { params = obj2.getString()->copy(); diff --git a/poppler/Sound.cc b/poppler/Sound.cc index 0dec645..6129fdc 100644 --- a/poppler/Sound.cc +++ b/poppler/Sound.cc @@ -1,5 +1,6 @@ /* Sound.cc - an object that holds the sound structure * Copyright (C) 2006-2007, Pino Toscano <[email protected]> + * Copyright (C) 2009, Albert Astals Cid <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,9 +69,10 @@ Sound::Sound(Object *obj, bool readAttrs) Object obj1; // valid 'F' key -> external file kind = soundExternal; - getFileSpecNameForPlatform (&tmp, &obj1); - fileName = obj1.getString()->copy(); - obj1.free(); + if (getFileSpecNameForPlatform (&tmp, &obj1)) { + fileName = obj1.getString()->copy(); + obj1.free(); + } } else { // no file specification, then the sound data have to be // extracted from the stream _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
