From 4589ce17caf94e7c5fa856906d3a8cc08e999d73 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Fri, 12 Sep 2014 19:22:20 +0200 Subject: glib: Fix use of uninitialized members in PopplerInputStream https://bugs.freedesktop.org/show_bug.cgi?id=82630 --- glib/poppler-input-stream.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/glib/poppler-input-stream.cc b/glib/poppler-input-stream.cc index 041cc2e0..e57e344b 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); -- cgit v1.2.3