summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/pdfio
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-12-01 15:05:19 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-12-01 19:34:25 +0000
commitcdf2ae1b6611976816fa60aae370893657c622d0 (patch)
tree328e48c0bcce0085a7b7df58899033e10363b7dc /xmlsecurity/source/pdfio
parente84993486b46ed86a8540b985355e82db5559720 (diff)
xmlsecurity PDF verify: fix reading names containing ']'
Also fix parsing '<< /Foo [ /Bar ] >>'. Change-Id: I3375001730b4d2e447b0dd8a7809a7bfb013126c Reviewed-on: https://gerrit.libreoffice.org/31498 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'xmlsecurity/source/pdfio')
-rw-r--r--xmlsecurity/source/pdfio/pdfdocument.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx b/xmlsecurity/source/pdfio/pdfdocument.cxx
index 81f8caae8655..1c949b161ee3 100644
--- a/xmlsecurity/source/pdfio/pdfdocument.cxx
+++ b/xmlsecurity/source/pdfio/pdfdocument.cxx
@@ -2906,14 +2906,19 @@ size_t PDFDictionaryElement::Parse(const std::vector< std::unique_ptr<PDFElement
}
else
{
- // Name-name key-value.
- rDictionary[aName] = pName;
- if (pThisDictionary)
+ if (pArray)
+ pArray->PushBack(pName);
+ else
{
- pThisDictionary->SetKeyOffset(aName, nNameOffset);
- pThisDictionary->SetKeyValueLength(aName, pName->GetLocation() + pName->GetLength() - nNameOffset);
+ // Name-name key-value.
+ rDictionary[aName] = pName;
+ if (pThisDictionary)
+ {
+ pThisDictionary->SetKeyOffset(aName, nNameOffset);
+ pThisDictionary->SetKeyValueLength(aName, pName->GetLocation() + pName->GetLength() - nNameOffset);
+ }
+ aName.clear();
}
- aName.clear();
}
continue;
}
@@ -3487,7 +3492,7 @@ bool PDFNameElement::Read(SvStream& rStream)
rStream.ReadChar(ch);
while (!rStream.IsEof())
{
- if (isspace(ch) || ch == '/' || ch == '[' || ch == '<' || ch == '>' || ch == '(')
+ if (isspace(ch) || ch == '/' || ch == '[' || ch == ']' || ch == '<' || ch == '>' || ch == '(')
{
rStream.SeekRel(-1);
m_aValue = aBuf.makeStringAndClear();