76f8c5
From 6912e06d9ab19ba28991b5cab3319d61d856bd6d Mon Sep 17 00:00:00 2001
76f8c5
From: Adam Reichold <adam.reichold@t-online.de>
76f8c5
Date: Tue, 6 Nov 2018 09:00:02 +0100
76f8c5
Subject: [PATCH] Check for stream before calling stream methods when saving an
76f8c5
 embedded file.
76f8c5
76f8c5
Closes #659
76f8c5
---
76f8c5
 poppler/FileSpec.cc | 3 +++
76f8c5
 1 file changed, 3 insertions(+)
76f8c5
76f8c5
diff --git a/poppler/FileSpec.cc b/poppler/FileSpec.cc
76f8c5
index 7479c2d2..d5543041 100644
76f8c5
--- a/poppler/FileSpec.cc
76f8c5
+++ b/poppler/FileSpec.cc
76f8c5
@@ -93,6 +93,9 @@ bool EmbFile::save(const char *path) {
76f8c5
 GBool EmbFile::save2(FILE *f) {
76f8c5
   int c;
76f8c5
 
76f8c5
+  if (unlikely(!m_objStr.isStream()))
76f8c5
+    return false;
76f8c5
+
76f8c5
   m_objStr.streamReset();
76f8c5
   while ((c = m_objStr.streamGetChar()) != EOF) {
76f8c5
     fputc(c, f);
76f8c5
-- 
76f8c5
2.19.1
76f8c5