[Libreoffice-commits] core.git: xmlsecurity/source

Stephan Bergmann sbergman at redhat.com
Tue Mar 21 13:30:02 UTC 2017


 xmlsecurity/source/pdfio/pdfdocument.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 9871f1eee320bca222af909a33b446ae70167883
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 21 12:43:18 2017 +0100

    Make PDFDocument::ReadKeyword work at end of file
    
    If the first ReadChar fails due to EOF, ch would be used uninitialized.  If the
    second ReadChar fails due to EOF, the SeekRel(-1) shouldn't be executed.
    
    Change-Id: Ibf99539a3a8880a77653bd7576721104f9782e36
    Reviewed-on: https://gerrit.libreoffice.org/35504
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx b/xmlsecurity/source/pdfio/pdfdocument.cxx
index 94ebd1f46b55..dd63c2395634 100644
--- a/xmlsecurity/source/pdfio/pdfdocument.cxx
+++ b/xmlsecurity/source/pdfio/pdfdocument.cxx
@@ -1311,12 +1311,14 @@ OString PDFDocument::ReadKeyword(SvStream& rStream)
     OStringBuffer aBuf;
     char ch;
     rStream.ReadChar(ch);
+    if (rStream.IsEof())
+        return OString();
     while (isalpha(ch))
     {
         aBuf.append(ch);
         rStream.ReadChar(ch);
         if (rStream.IsEof())
-            break;
+            return aBuf.toString();
     }
     rStream.SeekRel(-1);
     return aBuf.toString();


More information about the Libreoffice-commits mailing list