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