File poppler-CVE-2022-27337.patch of Package poppler-qt5.31254

Index: poppler-0.62.0/poppler/Hints.cc
===================================================================
--- poppler-0.62.0.orig/poppler/Hints.cc
+++ poppler-0.62.0/poppler/Hints.cc
@@ -189,13 +189,31 @@ void Hints::readTables(BaseStream *str,
 
   Stream *s = str->makeSubStream(hintsOffset, gFalse, hintsLength, Object(objNull));
   s->reset();
-  for (Guint i=0; i < hintsLength; i++) { *p++ = s->getChar(); }
+  for (Guint i=0; i < hintsLength; i++) {
+    const int c = s->getChar();
+    if (unlikely(c == EOF)) {
+      error(errSyntaxWarning, -1, "Found EOF while reading hints");
+      ok = false;
+      delete s;
+      return;
+    }
+    *p++ = c;
+  }
   delete s;
 
   if (hintsOffset2 && hintsLength2) {
     s = str->makeSubStream(hintsOffset2, gFalse, hintsLength2, Object(objNull));
     s->reset();
-    for (Guint i=0; i < hintsLength2; i++) { *p++ = s->getChar(); }
+    for (Guint i=0; i < hintsLength2; i++) {
+    const int c = s->getChar();
+      if (unlikely(c == EOF)) {
+        error(errSyntaxWarning, -1, "Found EOF while reading hints");
+        ok = false;
+        delete s;
+        return;
+      }
+      *p++ = c;
+    }
     delete s;
   }
 
openSUSE Build Service is sponsored by