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