#include "core/fpdfapi/parser/cpdf_syntax_parser.h"
#include <ctype.h>
#include <algorithm>
#include <utility>
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_boolean.h"
#include "core/fpdfapi/parser/cpdf_crypto_handler.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_null.h"
#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfapi/parser/cpdf_read_validator.h"
#include "core/fpdfapi/parser/cpdf_reference.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_string.h"
#include "core/fpdfapi/parser/fpdf_parser_utility.h"
#include "core/fxcrt/autorestorer.h"
#include "core/fxcrt/cfx_read_only_vector_stream.h"
#include "core/fxcrt/check.h"
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/data_vector.h"
#include "core/fxcrt/fixed_size_data_vector.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_memcpy_wrappers.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/stl_util.h"
namespace {
enum class ReadStatus { … };
class ReadableSubStream final : public IFX_SeekableReadStream { … };
}
int CPDF_SyntaxParser::s_CurrentRecursionDepth = …;
std::unique_ptr<CPDF_SyntaxParser> CPDF_SyntaxParser::CreateForTesting(
RetainPtr<IFX_SeekableReadStream> pFileAccess,
FX_FILESIZE HeaderOffset) { … }
CPDF_SyntaxParser::CPDF_SyntaxParser(
RetainPtr<IFX_SeekableReadStream> pFileAccess)
: … { … }
CPDF_SyntaxParser::CPDF_SyntaxParser(RetainPtr<CPDF_ReadValidator> validator,
FX_FILESIZE HeaderOffset)
: … { … }
CPDF_SyntaxParser::~CPDF_SyntaxParser() = default;
bool CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) { … }
bool CPDF_SyntaxParser::ReadBlockAt(FX_FILESIZE read_pos) { … }
bool CPDF_SyntaxParser::GetNextChar(uint8_t& ch) { … }
FX_FILESIZE CPDF_SyntaxParser::GetDocumentSize() const { … }
bool CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t* ch) { … }
bool CPDF_SyntaxParser::ReadBlock(pdfium::span<uint8_t> buffer) { … }
CPDF_SyntaxParser::WordType CPDF_SyntaxParser::GetNextWordInternal() { … }
ByteString CPDF_SyntaxParser::ReadString() { … }
DataVector<uint8_t> CPDF_SyntaxParser::ReadHexString() { … }
void CPDF_SyntaxParser::ToNextLine() { … }
void CPDF_SyntaxParser::ToNextWord() { … }
enum class EofState { … };
void CPDF_SyntaxParser::RecordingToNextWord() { … }
CPDF_SyntaxParser::WordResult CPDF_SyntaxParser::GetNextWord() { … }
ByteString CPDF_SyntaxParser::PeekNextWord() { … }
ByteString CPDF_SyntaxParser::GetKeyword() { … }
void CPDF_SyntaxParser::SetPos(FX_FILESIZE pos) { … }
RetainPtr<CPDF_Object> CPDF_SyntaxParser::GetObjectBody(
CPDF_IndirectObjectHolder* pObjList) { … }
RetainPtr<CPDF_Object> CPDF_SyntaxParser::GetObjectBodyInternal(
CPDF_IndirectObjectHolder* pObjList,
ParseType parse_type) { … }
RetainPtr<CPDF_Object> CPDF_SyntaxParser::GetIndirectObject(
CPDF_IndirectObjectHolder* pObjList,
ParseType parse_type) { … }
unsigned int CPDF_SyntaxParser::ReadEOLMarkers(FX_FILESIZE pos) { … }
FX_FILESIZE CPDF_SyntaxParser::FindWordPos(ByteStringView word) { … }
FX_FILESIZE CPDF_SyntaxParser::FindStreamEndPos() { … }
RetainPtr<CPDF_Stream> CPDF_SyntaxParser::ReadStream(
RetainPtr<CPDF_Dictionary> pDict) { … }
uint32_t CPDF_SyntaxParser::GetDirectNum() { … }
RetainPtr<CPDF_ReadValidator> CPDF_SyntaxParser::GetValidator() const { … }
bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
ByteStringView tag,
bool checkKeyword) { … }
bool CPDF_SyntaxParser::BackwardsSearchToWord(ByteStringView word,
FX_FILESIZE limit) { … }
FX_FILESIZE CPDF_SyntaxParser::FindTag(ByteStringView tag) { … }
bool CPDF_SyntaxParser::IsPositionRead(FX_FILESIZE pos) const { … }