File poppler-CVE-2018-18897.patch of Package poppler.30683

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 87b7ce03d446ae9db35910d91d06ba8610573217..4e3ccbfdaf27a8eabee4b72c3dc1eb0c6f5afc5f 100644
Index: poppler-0.24.4/poppler/GfxState.cc
===================================================================
--- poppler-0.24.4.orig/poppler/GfxState.cc
+++ poppler-0.24.4/poppler/GfxState.cc
@@ -227,10 +227,19 @@ static unsigned int getCMSNChannels(cmsC
 static cmsHPROFILE loadColorProfile(const char *fileName);
 
 void GfxColorSpace::setDisplayProfile(void *displayProfileA) {
+  if (displayProfile != NULL) {
+    error(errInternal, -1, "The display color profile can only be set once before any rendering is done.");
+    return;
+  }
   displayProfile = displayProfileA;
 }
 
 void GfxColorSpace::setDisplayProfileName(GooString *name) {
+  if (displayProfile != NULL) {
+    error(errInternal, -1, "The display color profile can only be set before any rendering is done.");
+    return;
+  }
+  delete displayProfileName;
   displayProfileName = name->copy();
 }
 
openSUSE Build Service is sponsored by