From 6bdd824188bc9a2e6b24b5752a3170ce10185c1d Mon Sep 17 00:00:00 2001 From: Wei Li Date: Thu, 23 Mar 2017 09:45:04 -0700 Subject: Fix two CloneNonCycle issues CloneNonCycle() tries to detect cyclic object references without copying them. There are two issues: -- for elements in an array or a dictionary, they should be able to refer to the same object, which are not cyclic; -- for cyclic referenced elements in an array or a dictionary, do not clone the element at all. Having nullptr or as an element, like we did before, might cause crash when the element being accessed. BUG=chromium:701860 Change-Id: Id0304accde76ed06fa5ce640994c7628359600fb Reviewed-on: https://pdfium-review.googlesource.com/3156 Commit-Queue: dsinclair Reviewed-by: dsinclair --- testing/resources/circular_viewer_ref.in | 24 +++++++++++++++++++++ testing/resources/circular_viewer_ref.pdf | 35 +++++++++++++++++++++++++++++++ testing/resources/repeat_viewer_ref.in | 19 +++++++++++++++++ testing/resources/repeat_viewer_ref.pdf | 30 ++++++++++++++++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 testing/resources/circular_viewer_ref.in create mode 100644 testing/resources/circular_viewer_ref.pdf create mode 100644 testing/resources/repeat_viewer_ref.in create mode 100644 testing/resources/repeat_viewer_ref.pdf (limited to 'testing/resources') diff --git a/testing/resources/circular_viewer_ref.in b/testing/resources/circular_viewer_ref.in new file mode 100644 index 0000000000..f791607e91 --- /dev/null +++ b/testing/resources/circular_viewer_ref.in @@ -0,0 +1,24 @@ +{{header}} +{{object 1 0}} +<> + >>>> +>> +endobj + +{{object 2 0}} +<> +endobj + +{{object 7 0}} +<> +endobj + +{{xref}} +trailer <> +{{startxref}} +%%EOF diff --git a/testing/resources/circular_viewer_ref.pdf b/testing/resources/circular_viewer_ref.pdf new file mode 100644 index 0000000000..2e5c4dd8ab --- /dev/null +++ b/testing/resources/circular_viewer_ref.pdf @@ -0,0 +1,35 @@ +%PDF-1.7 +% ò¤ô +1 0 obj +<> + >>>> +>> +endobj + +2 0 obj +<> +endobj + +7 0 obj +<> +endobj + +xref +0 8 +0000000000 65535 f +0000000015 00000 n +0000000157 00000 n +0000000000 65535 f +0000000000 65535 f +0000000000 65535 f +0000000000 65535 f +0000000195 00000 n +trailer <> +startxref +291 +%%EOF diff --git a/testing/resources/repeat_viewer_ref.in b/testing/resources/repeat_viewer_ref.in new file mode 100644 index 0000000000..6b436e535f --- /dev/null +++ b/testing/resources/repeat_viewer_ref.in @@ -0,0 +1,19 @@ +{{header}} +{{object 1 0}} +<>/ViewerPreferences<< +<>/ViewerPreferences<< +<>/ViewerPreferences<<>> +endobj + +{{object 2 0}} +<> +endobj + +{{object 7 0}} +<> +endobj + +{{xref}} +trailer <> +{{startxref}} +%%EOF diff --git a/testing/resources/repeat_viewer_ref.pdf b/testing/resources/repeat_viewer_ref.pdf new file mode 100644 index 0000000000..3f4ee47724 --- /dev/null +++ b/testing/resources/repeat_viewer_ref.pdf @@ -0,0 +1,30 @@ +%PDF-1.7 +% ò¤ô +1 0 obj +<>/ViewerPreferences<< +<>/ViewerPreferences<< +<>/ViewerPreferences<<>> +endobj + +2 0 obj +<> +endobj + +7 0 obj +<> +endobj + +xref +0 8 +0000000000 65535 f +0000000015 00000 n +0000000183 00000 n +0000000000 65535 f +0000000000 65535 f +0000000000 65535 f +0000000000 65535 f +0000000221 00000 n +trailer <> +startxref +317 +%%EOF -- cgit v1.2.3