[poppler] glib/poppler-input-stream.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sat Sep 13 06:37:10 PDT 2014


 glib/poppler-input-stream.cc |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 4589ce17caf94e7c5fa856906d3a8cc08e999d73
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Fri Sep 12 19:22:20 2014 +0200

    glib: Fix use of uninitialized members in PopplerInputStream
    
    https://bugs.freedesktop.org/show_bug.cgi?id=82630

diff --git a/glib/poppler-input-stream.cc b/glib/poppler-input-stream.cc
index 041cc2e..e57e344 100644
--- a/glib/poppler-input-stream.cc
+++ b/glib/poppler-input-stream.cc
@@ -31,6 +31,8 @@ PopplerInputStream::PopplerInputStream(GInputStream *inputStreamA, GCancellable
   length = lengthA;
   bufPtr = bufEnd = buf;
   bufPos = start;
+  savePos = 0;
+  saved = gFalse;
 }
 
 PopplerInputStream::~PopplerInputStream()
@@ -77,6 +79,7 @@ void PopplerInputStream::setPos(Goffset pos, int dir)
 
   if (dir >= 0) {
     g_seekable_seek(seekable, pos, G_SEEK_SET, cancellable, NULL);
+    bufPos = pos;
   } else {
     g_seekable_seek(seekable, 0, G_SEEK_END, cancellable, NULL);
     size = (Guint)g_seekable_tell(seekable);
@@ -110,7 +113,7 @@ GBool PopplerInputStream::fillBuf()
   if (limited && bufPos + inputStreamBufSize > start + length) {
     n = start + length - bufPos;
   } else {
-    n = inputStreamBufSize;
+    n = inputStreamBufSize - (bufPos % inputStreamBufSize);
   }
 
   n = g_input_stream_read(inputStream, buf, n, cancellable, NULL);


More information about the poppler mailing list