You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-Avoid-crash-when-a-com...

37 lines
1.8 KiB

From 3750deae3e2d8fcf8bcf795fe327e1da370a2c4d Mon Sep 17 00:00:00 2001
From: Katarina Behrens <bubli@bubli.org>
Date: Fri, 13 Sep 2013 17:29:12 +0200
Subject: [PATCH] Avoid crash when a comment contains data, but no text
calling back() on empty vector results in undef behaviour
Crash originally reported here:
http://lists.freedesktop.org/archives/libreoffice/2013-September/055827.html
Change-Id: Ibefdc7e2495fc31d748c16fedd3cee5eb957bfa2
---
oox/source/ppt/presentationfragmenthandler.cxx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index 247b81b..826130c 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -323,8 +323,12 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, sal_Bool bFirst
//set comment chars for last comment on slide
SlideFragmentHandler* comment_handler =
dynamic_cast<SlideFragmentHandler*>(xCommentsFragmentHandler.get());
+ // some comments have no text -> set empty string as text to avoid
+ // crash (back() on empty vector is undefined) and losing other
+ // comment data that might be there (author, position, timestamp etc.)
pCommentsPersistPtr->getCommentsList().cmLst.back().setText(
- comment_handler->getCharVector().back() );
+ comment_handler->getCharVector().empty() ? "" :
+ comment_handler->getCharVector().back() );
pCommentsPersistPtr->getCommentAuthors().setValues(maAuthorList);
//insert all comments from commentsList
--
1.8.3.1