[Libreoffice-commits] core.git: Blind fix to TBs

Stephan Bergmann sbergman at redhat.com
Mon Oct 24 08:29:41 UTC 2016


On 10/23/2016 05:21 PM, Julien Nabet wrote:
> commit f736c71dde8f4a84688b932b1531808d4c7cbd8c
> Author: Julien Nabet <serval2412 at 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 at yahoo.fr>
>     Tested-by: Julien Nabet <serval2412 at 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);



More information about the LibreOffice mailing list