summaryrefslogtreecommitdiff
path: root/xmlsecurity/inc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-10-28 17:34:55 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-10-28 18:20:20 +0200
commit56cc352d8229c16604f39a21bd77a05b422470f4 (patch)
tree521e48e97c5cab98de2df49508009ad5082bfddf /xmlsecurity/inc
parentb41e7b817e1e214582505d28d0cc36d741fa9979 (diff)
xmlsecurity PDF verify: initial support of cross-reference streams
This adds support for cross-reference streams (which can be used instead of plain-text cross-reference tables) + also one stream predictor. The actual parsed data is still not used, though. Change-Id: Ia806abd8a97636a1bd25dfdafea377b088800f00
Diffstat (limited to 'xmlsecurity/inc')
-rw-r--r--xmlsecurity/inc/pdfio/pdfdocument.hxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/xmlsecurity/inc/pdfio/pdfdocument.hxx b/xmlsecurity/inc/pdfio/pdfdocument.hxx
index 8ef7afdf2c66..80a8de68f1fd 100644
--- a/xmlsecurity/inc/pdfio/pdfdocument.hxx
+++ b/xmlsecurity/inc/pdfio/pdfdocument.hxx
@@ -38,6 +38,16 @@ public:
virtual ~PDFElement() { }
};
+enum class TokenizeMode
+{
+ /// Full file.
+ END_OF_STREAM,
+ /// Till the first %%EOF token.
+ EOF_TOKEN,
+ /// Till the end of the current object.
+ END_OF_OBJECT
+};
+
/**
* In-memory representation of an on-disk PDF document.
*
@@ -64,8 +74,8 @@ class XMLSECURITY_DLLPUBLIC PDFDocument
static int AsHex(char ch);
/// Decode a hex dump.
static std::vector<unsigned char> DecodeHexString(PDFHexStringElement* pElement);
- /// Tokenize elements from current offset, optionally only till the next EOF.
- bool Tokenize(SvStream& rStream, bool bPartial);
+ /// Tokenize elements from current offset.
+ bool Tokenize(SvStream& rStream, TokenizeMode eMode);
public:
PDFDocument();
@@ -74,6 +84,7 @@ public:
static OString ReadKeyword(SvStream& rStream);
static size_t FindStartXRef(SvStream& rStream);
void ReadXRef(SvStream& rStream);
+ void ReadXRefStream(SvStream& rStream);
static void SkipWhitespace(SvStream& rStream);
/// Instead of all whitespace, just skip CR and NL characters.
static void SkipLineBreaks(SvStream& rStream);