summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-12-21 00:11:28 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-12-21 00:11:28 +0800
commitb8574446d346bf1a026a208550e8da35501f97f0 (patch)
treee227a3069903dfb74c02bc18ddd2dcffb32e1d41
parent9c061e2dfb22a0e321728b73c8650eded8828d90 (diff)
downloadpdfium-b8574446d346bf1a026a208550e8da35501f97f0.tar.xz
Fix wrong rendering on greyscale images with index colorspace
BUG=514514 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1536223002 .
-rw-r--r--third_party/libopenjpeg20/0007-jp2_read_cmap.patch13
-rw-r--r--third_party/libopenjpeg20/README.pdfium1
-rw-r--r--third_party/libopenjpeg20/jp2.c2
3 files changed, 15 insertions, 1 deletions
diff --git a/third_party/libopenjpeg20/0007-jp2_read_cmap.patch b/third_party/libopenjpeg20/0007-jp2_read_cmap.patch
new file mode 100644
index 0000000000..30f9e4b2d7
--- /dev/null
+++ b/third_party/libopenjpeg20/0007-jp2_read_cmap.patch
@@ -0,0 +1,13 @@
+diff --git a/third_party/libopenjpeg20/jp2.c b/third_party/libopenjpeg20/jp2.c
+index 6e910a9..f3baca5 100644
+--- a/third_party/libopenjpeg20/jp2.c
++++ b/third_party/libopenjpeg20/jp2.c
+@@ -1194,7 +1194,7 @@ static OPJ_BOOL opj_jp2_read_cmap( opj_jp2_t * jp2,
+
+
+ for(i = 0; i < nr_channels; ++i) {
+- opj_read_bytes(p_cmap_header_data, &l_value, 2); /* CMP^i */
++ opj_read_bytes_BE(p_cmap_header_data, &l_value, 2); /* CMP^i */
+ p_cmap_header_data +=2;
+ cmap[i].cmp = (OPJ_UINT16) l_value;
+
diff --git a/third_party/libopenjpeg20/README.pdfium b/third_party/libopenjpeg20/README.pdfium
index e3d61e891c..4d5585713b 100644
--- a/third_party/libopenjpeg20/README.pdfium
+++ b/third_party/libopenjpeg20/README.pdfium
@@ -16,4 +16,5 @@ Local Modifications:
0004-j2k_read_mcc.patch: Move incrementing of l_tcp->m_nb_mcc_records to the right place.
0005-jp2_apply_pclr.patch: Fix out of bounds access.
0006-tcd_init_tile.patch: Fix a dividing zero bug in opj_tcd_init_tile().
+0007-jp2_read_cmap.patch: Fix wrong rendering on greyscale images with index colorspace.
TODO(thestig): List all the other patches.
diff --git a/third_party/libopenjpeg20/jp2.c b/third_party/libopenjpeg20/jp2.c
index 6e910a911a..f3baca53bd 100644
--- a/third_party/libopenjpeg20/jp2.c
+++ b/third_party/libopenjpeg20/jp2.c
@@ -1194,7 +1194,7 @@ static OPJ_BOOL opj_jp2_read_cmap( opj_jp2_t * jp2,
for(i = 0; i < nr_channels; ++i) {
- opj_read_bytes(p_cmap_header_data, &l_value, 2); /* CMP^i */
+ opj_read_bytes_BE(p_cmap_header_data, &l_value, 2); /* CMP^i */
p_cmap_header_data +=2;
cmap[i].cmp = (OPJ_UINT16) l_value;