summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-09-25 20:32:46 -0700
committerJun Fang <jun_fang@foxitsoftware.com>2015-09-25 20:32:46 -0700
commit9bd18183ba8210c91d71c3060146235750a4c71c (patch)
treee1950c29e9e295dd247a0edc5ed8d490e18800d8 /core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
parent163f59b9a0b019539e9a463ec183c964e7317d5b (diff)
downloadpdfium-9bd18183ba8210c91d71c3060146235750a4c71c.tar.xz
Fix the issue that pdfium swallows 'fi' or 'ff' in some pdf files
Pdfium swallows 'fi' or 'ff' in some tested files because it doesn't load the embedded font file correctly. The root cause is that there is incorrect keyword like 'ngendstream' in the stream of the embedded font file. Pdfium tries to find another correct keyword but uses wrong offset rather than accumulated offset. BUG=524043 R=thestig@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1307353005 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp34
1 files changed, 2 insertions, 32 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 48e9b98d3a..c9bcff6db6 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -9,27 +9,7 @@
#include "../../../include/fxcodec/fx_codec.h"
#include "pageint.h"
#include <limits.h>
-const FX_CHAR* const _PDF_OpCharType =
- "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"
- "IIVIIIIVIIVIIIIIVVIIIIIIIIIIIIII"
- "IIVVVVVVIVVVVVVIVVVVVIIVVIIIIIII"
- "IIVVVVVVVVVVVVVVIVVVIIVVIVVIIIII"
- "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"
- "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"
- "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"
- "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII";
-FX_BOOL _PDF_HasInvalidOpChar(const FX_CHAR* op) {
- if (!op) {
- return FALSE;
- }
- uint8_t ch;
- while ((ch = *op++)) {
- if (_PDF_OpCharType[ch] == 'I') {
- return TRUE;
- }
- }
- return FALSE;
-}
+
class CPDF_StreamParserAutoClearer {
public:
CPDF_StreamParserAutoClearer(CPDF_StreamParser** scoped_variable,
@@ -61,13 +41,7 @@ FX_DWORD CPDF_StreamContentParser::Parse(const uint8_t* pData,
case CPDF_StreamParser::EndOfData:
return m_pSyntax->GetPos();
case CPDF_StreamParser::Keyword:
- if (!OnOperator((char*)syntax.GetWordBuf()) &&
- _PDF_HasInvalidOpChar((char*)syntax.GetWordBuf())) {
- m_bAbort = TRUE;
- }
- if (m_bAbort) {
- return m_pSyntax->GetPos();
- }
+ OnOperator((char*)syntax.GetWordBuf());
ClearAllParams();
break;
case CPDF_StreamParser::Number:
@@ -1126,10 +1100,6 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) {
m_CurrentOffset +=
m_pParser->Parse(m_pData + m_CurrentOffset,
m_Size - m_CurrentOffset, PARSE_STEP_LIMIT);
- if (m_pParser->ShouldAbort()) {
- m_InternalStage = PAGEPARSE_STAGE_CHECKCLIP;
- continue;
- }
}
}
if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) {