View Issue Details

IDProjectCategoryView StatusLast Update
0006464ScribusImport / Exportpublic2009-05-12 20:08
Reportergerfriedc Assigned Tofschmid  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
PlatformI86OSVistaOS VersionProf.
Product Version1.3.4 
Target Version1.3.5Fixed in Version1.3.5svn 
Summary0006464: eps import hang scribus when importing file with image
DescriptionEvery import either from 3.x or 3.4 hangs if there are graphic elements in the eps.
The cause is the gswin32c.exe which consumes 50% of the dual core performance but the progress bar does not change




Steps To Reproduceeps file is attached
Additional Information Eps import with text only works...
TagsNo tags attached.
Patch

Relationships

has duplicate 0006550 closedjghali Maybe the grayscale functionality doesn't work in PDFs. 
related to 0008019 closedfschmid included images in eps import not imported correctly 
related to 0008020 closed string toDouble conversions break when locale changes 

Activities

2007-11-08 10:01

 

45erkampagne_b_1.eps (2,573,062 bytes)

gerfriedc

2007-11-08 10:04

reporter   ~0017872

The Version of gswin32c is 8.53.

jghali

2007-11-15 23:06

administrator   ~0017926

Reminder sent to: avox

I get this output in the error file:
image
i_image

Looking quickly at the file, the embedded image seems to use a Postscript csa in its colorspace.

fschmid

2008-11-25 16:04

administrator   ~0020701

Disabling the image reading code in the import.prolog fixes the hang. Moving that bug to 1.3.6 now, as a real fix is out of the scope of our current timeframe.

pspencer

2009-03-11 21:09

reporter   ~0021279

The freeze is because the image-reading code goes into an infinite loop if it runs out of data to read.

It is legal for a PostScript image to contain less data than the image actually requires--samples for which no data can be read are to be left unpainted. The following 2-line patch fixes this hang (by padding unsupplied data with zeros) without needing to disable the image reading code:

--- import.prolog.hang 2009-03-11 17:02:55.000000000 -0400
+++ import.prolog 2009-03-11 17:05:08.000000000 -0400
@@ -1016,6 +1016,7 @@
       dup type /filetype eq
        { i_buf 0 i_left 32 .min getinterval readstring pop
        } if
+ dup length 0 eq {pop i_zero 0 i_left 32 .min getinterval} if
       dup i_file exch writestring
       i_left exch length sub /i_left exch def
     } loop
@@ -1124,6 +1125,7 @@
 /i_datasource { (x) } def
 /i_file null def
 /i_filecount 1 def
+/i_zero 32 string def
 
 %%%% End of traceimage code
 
With this patch the reporter's eps file will load without hanging. It will fail to render some of the images due to a separate issue (the import.prolog doesn't correctly handle images with multiple data sources: it writes them out as if a single data source, and the resulting .dat file has an inconsistent /MultipleDataSources true but only a single data source provided) but at least it doesn't hang and loads a larger class of images than if the image-reading code was completely disabled.

jghali

2009-05-08 19:07

administrator   ~0021699

Last edited: 2009-05-08 19:07

pspencer : I've committed your patch, thanks and sorry for the delay!

2009-05-08 19:16

 

scribusxml.patch (2,709 bytes)   
Index: scribusXml.cpp
===================================================================
--- scribusXml.cpp	(revision 13447)
+++ scribusXml.cpp	(working copy)
@@ -21,6 +21,7 @@
 #include <QCursor>
 #include <QDir>
 #include <QFile>
+#include <QLocale>
 #include <QRegExp>
 #include <QTextCodec>
 #include <QTextStream>
@@ -103,7 +104,7 @@
 	double value = defVal;
 	QStringRef att = attrs.value(attString);
 	if (!att.isEmpty())
-		value = QString::fromRawData(att.constData(), att.length()).toDouble();
+		value = QLocale::c().toDouble(QString::fromRawData(att.constData(), att.length()));
 	return value;
 }
 
@@ -315,6 +316,8 @@
 		{
 			fc >> x;
 			fc >> y;
+
+
 			OB->Clip.setPoint(c, x, y);
 		}
 	}
@@ -329,8 +332,11 @@
 		QTextStream fp(&tmp, QIODevice::ReadOnly);
 		for (int cx=0; cx < numPo; ++cx)
 		{
-			fp >> xf;
-			fp >> yf;
+			QString a,b;
+			fp >> a;
+			fp >> b;
+			xf=QLocale::c().toDouble(a);
+			yf=QLocale::c().toDouble(b);
 			OB->PoLine.setPoint(cx, xf, yf);
 		}
 	}
@@ -345,8 +351,11 @@
 		QTextStream fp(&tmp, QIODevice::ReadOnly);
 		for (int cx=0; cx < numCo; ++cx)
 		{
-			fp >> xf;
-			fp >> yf;
+			QString a,b;
+			fp >> a;
+			fp >> b;
+			xf=QLocale::c().toDouble(a);
+			yf=QLocale::c().toDouble(b);
 			OB->ContourLine.setPoint(cx, xf, yf);
 		}
 	}
@@ -362,8 +371,12 @@
 		OB->TabValues.clear();
 		for (int cxv = 0; cxv < numTab; cxv += 2)
 		{
-			tgv >> xf;
-			tgv >> xf2;
+			QString a,b;
+			tgv >> a;
+			tgv >> b;
+			xf=QLocale::c().toDouble(a);
+			xf2=QLocale::c().toDouble(b);
+
 			tb.tabPosition = xf2;
 			tb.tabType = static_cast<int>(xf);
 			tb.tabFillChar = QChar();
@@ -902,10 +915,10 @@
 				QString atty = attrs.value("YP").toString();
 				QString attw = attrs.value("W").toString();
 				QString atth = attrs.value("H").toString();
-				*x = (attx.isEmpty()) ? 0.0 : attx.toDouble();
-				*y = (atty.isEmpty()) ? 0.0 : atty.toDouble();
-				*w = (attw.isEmpty()) ? 0.0 : attw.toDouble();
-				*h = (atth.isEmpty()) ? 0.0 : atth.toDouble();
+				*x = (attx.isEmpty()) ? 0.0 : QLocale::c().toDouble(attx);
+				*y = (atty.isEmpty()) ? 0.0 : QLocale::c().toDouble(atty);
+				*w = (attw.isEmpty()) ? 0.0 : QLocale::c().toDouble(attw);
+				*h = (atth.isEmpty()) ? 0.0 : QLocale::c().toDouble(atth);
 				succeed = true;
 			}
 		}
@@ -973,8 +986,8 @@
 				QXmlStreamAttributes attrs = sReader.attributes();
 				if (!loc)
 				{
-					GrX = attrs.value("XP").toString().toDouble();
-					GrY = attrs.value("YP").toString().toDouble();
+					GrX = QLocale::c().toDouble(attrs.value("XP").toString());
+					GrY = QLocale::c().toDouble(attrs.value("YP").toString());
 				}
 				if (!attrs.value("Version").isEmpty())
 					newVersion = true;
scribusxml.patch (2,709 bytes)   

cbradney

2009-05-08 21:21

administrator   ~0021700

Resolving as the hang issue has been fixed, 2 more issues discovered, as related.

Issue History

Date Modified Username Field Change
2007-11-08 10:01 gerfriedc New Issue
2007-11-08 10:01 gerfriedc File Added: 45erkampagne_b_1.eps
2007-11-08 10:04 gerfriedc Note Added: 0017872
2007-11-15 22:53 jghali Summary hangs with gswin32c.exe => eps import hang scribus when importing file with image
2007-11-15 23:06 jghali Note Added: 0017926
2007-11-19 13:43 jghali Status new => confirmed
2007-12-03 16:58 jghali Relationship added has duplicate 0006550
2008-03-08 01:06 christoph_s Assigned To => fschmid
2008-03-08 01:06 christoph_s Target Version => 1.3.5
2008-03-08 03:07 christoph_s Status confirmed => assigned
2008-03-19 19:12 christoph_s Relationship added child of 0005693
2008-11-25 16:04 fschmid Note Added: 0020701
2008-11-25 16:05 fschmid Target Version 1.3.5 => 1.3.6
2008-11-25 16:06 fschmid Relationship deleted child of 0005693
2009-03-11 21:09 pspencer Note Added: 0021279
2009-05-08 18:38 cbradney Severity crash => block
2009-05-08 18:38 cbradney Target Version 1.5.0 => 1.3.5
2009-05-08 19:07 jghali Note Added: 0021699
2009-05-08 19:07 jghali Note Edited: 0021699
2009-05-08 19:16 cbradney File Added: scribusxml.patch
2009-05-08 21:20 cbradney Issue cloned: 0008019
2009-05-08 21:20 cbradney Relationship added related to 0008019
2009-05-08 21:21 cbradney Note Added: 0021700
2009-05-08 21:21 cbradney Status assigned => resolved
2009-05-08 21:21 cbradney Fixed in Version => 1.3.5svn
2009-05-08 21:21 cbradney Resolution open => fixed
2009-05-08 21:24 cbradney Relationship added related to 0008020
2009-05-12 20:08 cbradney Status resolved => closed