summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-05-11 20:15:37 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-11 20:15:37 +0000
commit466bd4f4e0cb2bc2a7b3626948609268c52c4690 (patch)
tree06a9d19f0bdfdad487fbe7b7ff35eb58ffdd759c
parentce7a8158376dd81e2321a77a331dca5f451b471c (diff)
downloadpdfium-466bd4f4e0cb2bc2a7b3626948609268c52c4690.tar.xz
Revert "Filter out "Type" and "DecodeParms" from trailer keys."
This reverts commit 5f7c5be8b7072d46e8d8088a1ec14370ecfad44c. Reason for revert: New test is flaky, ID is not stable. Original change's description: > Filter out "Type" and "DecodeParms" from trailer keys. > > Bug: pdfium:873 > Change-Id: I12ae5b8776f5a73c4be81bed53ada05c94d46882 > Reviewed-on: https://pdfium-review.googlesource.com/32190 > Reviewed-by: dsinclair <dsinclair@chromium.org> > Commit-Queue: dsinclair <dsinclair@chromium.org> TBR=dsinclair@chromium.org,hnakashima@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: pdfium:873 Change-Id: I642771e12c61181c7b81681dae7b2f5549c14b18 Reviewed-on: https://pdfium-review.googlesource.com/32430 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
-rw-r--r--core/fpdfapi/edit/cpdf_creator.cpp3
-rw-r--r--core/fpdfapi/edit/cpdf_creator_embeddertest.cpp20
2 files changed, 1 insertions, 22 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 71237f7915..1e33bbceb8 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -627,8 +627,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4() {
CPDF_Object* pValue = it.second.get();
if (key == "Encrypt" || key == "Size" || key == "Filter" ||
key == "Index" || key == "Length" || key == "Prev" || key == "W" ||
- key == "XRefStm" || key == "ID" || key == "DecodeParms" ||
- key == "Type") {
+ key == "XRefStm" || key == "ID") {
continue;
}
if (!m_Archive->WriteString(("/")) ||
diff --git a/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp b/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp
index f8520c4238..1913c4ba19 100644
--- a/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp
+++ b/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <cstring>
#include <memory>
#include <string>
#include <vector>
@@ -13,7 +12,6 @@
#include "public/fpdf_edit.h"
#include "public/fpdfview.h"
#include "testing/embedder_test.h"
-#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gtest/include/gtest/gtest.h"
class CPDF_CreatorEmbedderTest : public EmbedderTest {};
@@ -44,21 +42,3 @@ TEST_F(CPDF_CreatorEmbedderTest, SavedDocsAreEqualAfterParse) {
// The sizes of saved docs should be equal.
EXPECT_EQ(saved_doc_1.size(), saved_doc_2.size());
}
-
-TEST_F(CPDF_CreatorEmbedderTest, BUG_873) {
- EXPECT_TRUE(OpenDocument("embedded_attachments.pdf"));
- EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
-
- // Cannot match second part of the ID since it is randomly generated.
- std::string saved_data = GetString();
- const char kTrailerBeforeSecondID[] =
- "trailer\r\n<</Info 9 0 R /Root 11 0 R /Size "
- "36/ID[<D889EB6B9ADF88E5EDA7DC08FE85978B><";
- ASSERT_THAT(saved_data, testing::HasSubstr(kTrailerBeforeSecondID));
- size_t trailer_start = saved_data.find(kTrailerBeforeSecondID);
- constexpr size_t kIdLen = 32;
- size_t trailer_continuation =
- trailer_start + strlen(kTrailerBeforeSecondID) + kIdLen;
- std::string data_after_second_id = saved_data.substr(trailer_continuation);
- EXPECT_THAT(data_after_second_id, testing::StartsWith(">]>>\r\n"));
-}