r19392 by jghali - #12580: trying to import emf disguised as wmf cause crash

scribus-commit scribus-commit at lists.scribus.net
Fri Aug 1 11:36:35 UTC 2014


Author: jghali
Date: Fri Aug  1 11:36:35 2014
New Revision: 19392

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19392
Log:
#12580: trying to import emf disguised as wmf cause crash

Modified:
    trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp

Modified: trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19392&path=/trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp Fri Aug  1 11:36:35 2014
@@ -512,7 +512,7 @@
 
 	//----- Test header validity
 	m_Valid = ((header.mtHeaderSize == 9) && (header.mtNoParameters == 0)) || m_IsEnhanced || m_IsPlaceable;
-	if ( m_Valid )
+	if ( m_Valid && !m_IsEnhanced )
 	{
 		//----- Read Metafile Records
 		rdFunc = -1;
@@ -520,6 +520,7 @@
 		{
 			st >> rdSize;
 			st >> rdFunc;
+
 			idx = findFunc( rdFunc );
 			rdSize -= 3;
 
@@ -558,12 +559,15 @@
 			cerr << "WMF : incorrect file format !" << endl;
 		}
 	}
+	else if ( m_IsEnhanced ) {
+		cerr << "WMF : unsupported Enhanced Metafile !" << endl;
+	}
 	else {
 		cerr << "WMF Header : incorrect header !" << endl;
 	}
 
 	buffer.close();
-	return m_Valid;
+	return ( m_Valid && !m_IsEnhanced );
 }
 
 bool WMFImport::importWMF(const TransactionSettings& trSettings, int flags)




More information about the scribus-commit mailing list