Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp

Issue 1406943005: Clear decoders after the image decoder in the /Filter array (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index e68fcb6800a30792db44dc2ec3f56e96c260a882..18233c764a61c9bd0a32ec01d413adfd431bb118 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -362,7 +362,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
// Use ToDictionary here because we can push NULL into the ParamList.
CPDF_Dictionary* pParam =
ToDictionary(static_cast<CPDF_Object*>(ParamList[i]));
- uint8_t* new_buf = NULL;
+ uint8_t* new_buf = nullptr;
FX_DWORD new_size = (FX_DWORD)-1;
int offset = -1;
if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
@@ -394,19 +394,21 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
return TRUE;
}
offset = RunLengthDecode(last_buf, last_size, new_buf, new_size);
- } else {
+ } else if (i == DecoderList.GetSize() - 1) {
jun_fang 2015/11/09 11:09:35 It's too strict checking here. The filters DCT(JP
Oliver Chang 2015/11/09 20:41:22 Apologies if I misunderstood something, but why is
jun_fang 2015/11/11 10:10:36 - The previous behavior is: all valid or invalid d
jun_fang 2015/11/11 10:13:39 I don't have the permission to access the test fil
Oliver Chang 2015/11/11 17:25:19 Thanks for the clarification! I see, so we still
+ // Check if this is an image decoder.
if (decoder == FX_BSTRC("DCT")) {
decoder = "DCTDecode";
} else if (decoder == FX_BSTRC("CCF")) {
decoder = "CCITTFaxDecode";
- } else if (decoder == FX_BSTRC("Crypt")) {
- continue;
}
ImageEncoding = decoder;
pImageParms = pParam;
dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
return TRUE;
+ } else {
+ // Ignore all other decoders.
+ continue;
}
if (last_buf != src_buf) {
FX_Free(last_buf);
@@ -419,7 +421,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
last_size = new_size;
}
ImageEncoding = "";
- pImageParms = NULL;
+ pImageParms = nullptr;
dest_buf = last_buf;
dest_size = last_size;
return TRUE;
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698