diff options
author | Chris Palmer <palmer@chromium.org> | 2017-09-11 11:13:24 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-11 18:54:49 +0000 |
commit | 56ec0818c3ed195c8de2daba951ddbcb4dc7d7bc (patch) | |
tree | 35b2a07f945e450feffc2d2d06d292ede23589f0 /third_party/libopenjpeg20 | |
parent | 131c0eb2e34ece6ede6288842cb3004ec3c600d4 (diff) | |
download | pdfium-56ec0818c3ed195c8de2daba951ddbcb4dc7d7bc.tar.xz |
Use the right allocate and free functions in OpenJPEG.
This patch was authored by Ke Liu of Tencent's Xuanwu Lab.
BUG=762374
Change-Id: Icb3ee98fb4c399b871ccf11e9920af7caf51be11
Reviewed-on: https://pdfium-review.googlesource.com/13610
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Chris Palmer <palmer@chromium.org>
Diffstat (limited to 'third_party/libopenjpeg20')
-rw-r--r-- | third_party/libopenjpeg20/0035-opj_image_data_free.patch | 35 | ||||
-rw-r--r-- | third_party/libopenjpeg20/image.c | 2 | ||||
-rw-r--r-- | third_party/libopenjpeg20/jp2.c | 4 |
3 files changed, 38 insertions, 3 deletions
diff --git a/third_party/libopenjpeg20/0035-opj_image_data_free.patch b/third_party/libopenjpeg20/0035-opj_image_data_free.patch new file mode 100644 index 0000000000..8bd03a214e --- /dev/null +++ b/third_party/libopenjpeg20/0035-opj_image_data_free.patch @@ -0,0 +1,35 @@ +diff --git a/third_party/libopenjpeg20/image.c b/third_party/libopenjpeg20/image.c +index e29172b2b..bf7a70194 100644 +--- a/third_party/libopenjpeg20/image.c ++++ b/third_party/libopenjpeg20/image.c +@@ -180,7 +180,7 @@ void opj_copy_image_header(const opj_image_t* p_image_src, + for (compno = 0; compno < p_image_dest->numcomps; compno++) { + opj_image_comp_t *image_comp = &(p_image_dest->comps[compno]); + if (image_comp->data) { +- opj_free(image_comp->data); ++ opj_image_data_free(image_comp->data); + } + } + opj_free(p_image_dest->comps); +diff --git a/third_party/libopenjpeg20/jp2.c b/third_party/libopenjpeg20/jp2.c +index 9178f3fd6..e7e2db8bb 100644 +--- a/third_party/libopenjpeg20/jp2.c ++++ b/third_party/libopenjpeg20/jp2.c +@@ -1083,7 +1083,7 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image, + if (!new_comps[i].data) { + while (i > 0) { + -- i; +- opj_free(new_comps[i].data); ++ opj_image_data_free(new_comps[i].data); + } + opj_free(new_comps); + opj_event_msg(p_manager, EVT_ERROR, +@@ -1107,7 +1107,7 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image, + /* Prevent null pointer access */ + if (!src || !dst) { + for (j = 0; j < nr_channels; ++j) { +- opj_free(new_comps[j].data); ++ opj_image_data_free(new_comps[j].data); + } + opj_free(new_comps); + new_comps = NULL; diff --git a/third_party/libopenjpeg20/image.c b/third_party/libopenjpeg20/image.c index e29172b2b5..bf7a701942 100644 --- a/third_party/libopenjpeg20/image.c +++ b/third_party/libopenjpeg20/image.c @@ -180,7 +180,7 @@ void opj_copy_image_header(const opj_image_t* p_image_src, for (compno = 0; compno < p_image_dest->numcomps; compno++) { opj_image_comp_t *image_comp = &(p_image_dest->comps[compno]); if (image_comp->data) { - opj_free(image_comp->data); + opj_image_data_free(image_comp->data); } } opj_free(p_image_dest->comps); diff --git a/third_party/libopenjpeg20/jp2.c b/third_party/libopenjpeg20/jp2.c index 9178f3fd63..e7e2db8bb4 100644 --- a/third_party/libopenjpeg20/jp2.c +++ b/third_party/libopenjpeg20/jp2.c @@ -1083,7 +1083,7 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image, if (!new_comps[i].data) { while (i > 0) { -- i; - opj_free(new_comps[i].data); + opj_image_data_free(new_comps[i].data); } opj_free(new_comps); opj_event_msg(p_manager, EVT_ERROR, @@ -1107,7 +1107,7 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image, /* Prevent null pointer access */ if (!src || !dst) { for (j = 0; j < nr_channels; ++j) { - opj_free(new_comps[j].data); + opj_image_data_free(new_comps[j].data); } opj_free(new_comps); new_comps = NULL; |