Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


On 10/23/2016 05:21 PM, Julien Nabet wrote:
commit f736c71dde8f4a84688b932b1531808d4c7cbd8c
Author: Julien Nabet <serval2412@yahoo.fr>
Date:   Sun Oct 23 16:12:43 2016 +0200

    Blind fix to TBs

    Change-Id: I74165378255e3c844ee7f91a5d4eb09a573784bd
    Reviewed-on: https://gerrit.libreoffice.org/30179
    Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
    Tested-by: Julien Nabet <serval2412@yahoo.fr>

diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx b/xmlsecurity/source/pdfio/pdfdocument.cxx
index 6543734..753c308 100644
--- a/xmlsecurity/source/pdfio/pdfdocument.cxx
+++ b/xmlsecurity/source/pdfio/pdfdocument.cxx
@@ -775,7 +775,7 @@ size_t PDFDocument::FindStartXRef(SvStream& rStream)
     // Find the "startxref" token, somewhere near the end of the document.
     std::vector<char> aBuf(1024);
     rStream.Seek(STREAM_SEEK_TO_END);
-    rStream.SeekRel(-1 * aBuf.size());
+    rStream.SeekRel(-1 * aBuf.capacity());

What problem does this attempt to fix?

The changed code looks rather broken to me: After construction, aBuf is guaranteed to have a size of 1024, while I think the standard doesn't make a guarantee on its exact capacity.

     size_t nBeforePeek = rStream.Tell();
     size_t nSize = rStream.ReadBytes(aBuf.data(), aBuf.size());
     rStream.Seek(nBeforePeek);


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.