vcl/source/filter/ipdf/pdfdocument.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
New commits: commit bca4f51e1bf098e0ebb7361a69a05a96268df98d Author: Felix Wiegand <felix.wieg...@mankido.de> AuthorDate: Fri Sep 25 09:21:12 2020 +0200 Commit: Miklos Vajna <vmik...@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 <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits