r14083 by jghali - #8488 : crash with Signal 0000011 on document loading Only part of the issue, do some sanity check when loading inline objects

scribus-commit scribus-commit at lists.scribus.net
Fri Oct 2 00:35:42 CEST 2009


Revision: 14083
Author: jghali
Date: 2009-10-01T22:34:45.471664Z
Commit message: #8488 : crash with Signal 0000011 on document loading
Only part of the issue, do some sanity check when loading inline objects

Changeset: 
M  /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M  /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
M  /trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp

Diffs:
Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus13format/scribus13format.cpp	(revision 14082)
+++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp	(revision 14083)
@@ -1869,8 +1869,11 @@
 
 		int pos = obj->itemText.length();
 		if (ch == SpecialChars::OBJECT) {
-			if (iobj != -1) {
-				obj->itemText.insertObject(pos, doc->FrameItems.at(iobj));
+			if (iobj >= 0) {
+				if (iobj < doc->FrameItems.count())
+					obj->itemText.insertObject(pos, doc->FrameItems.at(iobj));
+				else
+					qDebug() << QString("scribus13format: invalid inline frame used in text object : %1").arg(iobj);
 			}
 		}
 		else {
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(revision 14082)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(revision 14083)
@@ -2090,8 +2090,11 @@
 		
 		int pos = obj->itemText.length();
 		if (ch == SpecialChars::OBJECT) {
-			if (iobj != -1) {
-				obj->itemText.insertObject(pos, doc->FrameItems.at(iobj));
+			if (iobj >= 0) {
+				if (iobj < doc->FrameItems.count())
+					obj->itemText.insertObject(pos, doc->FrameItems.at(iobj));
+				else
+					qDebug() << QString("scribus150format: invalid inline frame used in text object : %1").arg(iobj);
 			}
 		}
 		else if (ch == SpecialChars::SHYPHEN && pos > 0)
Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format.cpp	(revision 14082)
+++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp	(revision 14083)
@@ -2153,8 +2153,11 @@
 		
 		int pos = obj->itemText.length();
 		if (ch == SpecialChars::OBJECT) {
-			if (iobj != -1) {
-				obj->itemText.insertObject(pos, doc->FrameItems.at(iobj));
+			if (iobj >= 0) {
+				if (iobj < doc->FrameItems.count())
+					obj->itemText.insertObject(pos, doc->FrameItems.at(iobj));
+				else
+					qDebug() << QString("scribus134format: invalid inline frame used in text object : %1").arg(iobj);
 			}
 		}
 		else if (ch == SpecialChars::SHYPHEN && pos > 0)




More information about the scribus-commit mailing list