summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-01-22 22:12:04 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-01-23 09:07:38 +0100
commitf58a16d5987c8e8c16580c514ce0c7b0895b4105 (patch)
tree86b408f576d45bb30729992c225cd61f1f595733 /vcl
parent90ae1e1bbbce7be9b2ff7add75923b1891e65df6 (diff)
tdf#114460 vcl: handle nested parentheses in PDF roundtrip
The roundtrip of the pdf image failed due to this. Change-Id: I88a9657e242dd2659f9bf06233e5fcbfeb43ceb5 Reviewed-on: https://gerrit.libreoffice.org/48362 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/filter/ipdf/pdfdocument.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 6921683d5054..af1eea1f57cf 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -2015,11 +2015,20 @@ bool PDFLiteralStringElement::Read(SvStream& rStream)
nPrevCh = ch;
rStream.ReadChar(ch);
+ // Start with 1 nesting level as we read a '(' above already.
+ int nDepth = 1;
OStringBuffer aBuf;
while (!rStream.eof())
{
+ if (ch == '(' && nPrevCh != '\\')
+ ++nDepth;
+
if (ch == ')' && nPrevCh != '\\')
+ --nDepth;
+
+ if (nDepth == 0)
{
+ // ')' of the outermost '(' is reached.
m_aValue = aBuf.makeStringAndClear();
SAL_INFO("vcl.filter", "PDFLiteralStringElement::Read: m_aValue is '" << m_aValue << "'");
return true;