diff options
Diffstat (limited to 'core/fpdfapi/parser/cpdf_syntax_parser.h')
-rw-r--r-- | core/fpdfapi/parser/cpdf_syntax_parser.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.h b/core/fpdfapi/parser/cpdf_syntax_parser.h index 962c32753d..ebd844c3e0 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.h +++ b/core/fpdfapi/parser/cpdf_syntax_parser.h @@ -60,16 +60,24 @@ class CPDF_SyntaxParser { ByteString GetNextWord(bool* bIsNumber); ByteString PeekNextWord(bool* bIsNumber); - RetainPtr<IFX_SeekableReadStream> GetFileAccess() const; - const RetainPtr<CPDF_ReadValidator>& GetValidator() const { return m_pFileAccess; } uint32_t GetDirectNum(); bool GetNextChar(uint8_t& ch); + // The document size may be smaller than the file size. + // The syntax parser use position relative to document + // offset (|m_HeaderOffset|). + // The document size will be FileSize - "Header offset". + // All offsets was readed from document, should not be great than document + // size. Use it for checks instead of real file size. + FX_FILESIZE GetDocumentSize() const; + + ByteString ReadString(); + ByteString ReadHexString(); + private: - friend class CPDF_Parser; friend class CPDF_DataAvail; friend class cpdf_syntax_parser_ReadHexString_Test; @@ -84,8 +92,6 @@ class CPDF_SyntaxParser { const ByteStringView& tag, bool checkKeyword); - ByteString ReadString(); - ByteString ReadHexString(); unsigned int ReadEOLMarkers(FX_FILESIZE pos); FX_FILESIZE FindWordPos(const ByteStringView& word); FX_FILESIZE FindStreamEndPos(); @@ -99,6 +105,9 @@ class CPDF_SyntaxParser { ParseType parse_type); FX_FILESIZE m_Pos; + // The syntax parser use position relative to header offset. + // The header contains at file start, and can follow after some stuff. We + // ignore this stuff. FX_FILESIZE m_HeaderOffset; FX_FILESIZE m_FileLen; WeakPtr<ByteStringPool> m_pPool; |