[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - vcl/source

Felix Wiegand (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 4 16:23:53 UTC 2020


 vcl/source/filter/ipdf/pdfdocument.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit bca4f51e1bf098e0ebb7361a69a05a96268df98d
Author:     Felix Wiegand <felix.wiegand at mankido.de>
AuthorDate: Fri Sep 25 09:21:12 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Nov 4 17:23:20 2020 +0100

    Correctly parse real numbers in PDFs
    
    The current way of parsing real numbers was not conforming to the PDF
    standard ([1]), failing to recognize real numbers without a leading
    zero, such as .6, or numbers with a leading +.
    
    [1] PDF 1.7 standard, p. 14
    
    (cherry picked from commit 0d68738d67eacdfebdca3c9183dc11f953b38174)
    
    Change-Id: I68eac4796b182f2632aa1152e58d63c054871581
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105296
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 009c01f323b6..7d1305fa364c 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -1210,7 +1210,8 @@ bool PDFDocument::Tokenize(SvStream& rStream, TokenizeMode eMode,
             }
             default:
             {
-                if (rtl::isAsciiDigit(static_cast<unsigned char>(ch)) || ch == '-')
+                if (rtl::isAsciiDigit(static_cast<unsigned char>(ch)) || ch == '-' || ch == '+'
+                    || ch == '.')
                 {
                     // Numbering object: an integer or a real.
                     auto pNumberElement = new PDFNumberElement();
@@ -2184,14 +2185,15 @@ bool PDFNumberElement::Read(SvStream& rStream)
     {
         return false;
     }
-    if (!rtl::isAsciiDigit(static_cast<unsigned char>(ch)) && ch != '-' && ch != '.')
+    if (!rtl::isAsciiDigit(static_cast<unsigned char>(ch)) && ch != '-' && ch != '+' && ch != '.')
     {
         rStream.SeekRel(-1);
         return false;
     }
     while (!rStream.eof())
     {
-        if (!rtl::isAsciiDigit(static_cast<unsigned char>(ch)) && ch != '-' && ch != '.')
+        if (!rtl::isAsciiDigit(static_cast<unsigned char>(ch)) && ch != '-' && ch != '+'
+            && ch != '.')
         {
             rStream.SeekRel(-1);
             m_nLength = rStream.Tell() - m_nOffset;


More information about the Libreoffice-commits mailing list