diff options
author | Jun Fang <jun_fang@foxitsoftware.com> | 2015-10-13 15:28:55 +0800 |
---|---|---|
committer | Jun Fang <jun_fang@foxitsoftware.com> | 2015-10-13 00:49:26 -0700 |
commit | e865ed12c4a476a4c74bf1ae97d3a6fa8ca06f0a (patch) | |
tree | 9b2bad54f5afe41a627b0848347c3442f3c33635 /third_party/libopenjpeg20/0001-image-data.patch | |
parent | a8a39e25af3c19bb91434fdf367cffa0e1536934 (diff) | |
download | pdfium-e865ed12c4a476a4c74bf1ae97d3a6fa8ca06f0a.tar.xz |
upgrade openjpeg to commit# cf352af
BUG=457480,497355
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1338973005 .
Diffstat (limited to 'third_party/libopenjpeg20/0001-image-data.patch')
-rw-r--r-- | third_party/libopenjpeg20/0001-image-data.patch | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/third_party/libopenjpeg20/0001-image-data.patch b/third_party/libopenjpeg20/0001-image-data.patch new file mode 100644 index 0000000000..5ae0149538 --- /dev/null +++ b/third_party/libopenjpeg20/0001-image-data.patch @@ -0,0 +1,26 @@ +diff --git a/third_party/libopenjpeg20/j2k.c b/third_party/libopenjpeg20/j2k.c +index e612d06..d515798 100644 +--- a/third_party/libopenjpeg20/j2k.c ++++ b/third_party/libopenjpeg20/j2k.c +@@ -8148,11 +8148,16 @@ static OPJ_BOOL opj_j2k_update_image_data (opj_tcd_t * p_tcd, OPJ_BYTE * p_data, + + /* Allocate output component buffer if necessary */ + if (!l_img_comp_dest->data) { +- +- l_img_comp_dest->data = (OPJ_INT32*) opj_calloc((OPJ_SIZE_T)l_img_comp_dest->w * (OPJ_SIZE_T)l_img_comp_dest->h, sizeof(OPJ_INT32)); +- if (! l_img_comp_dest->data) { +- return OPJ_FALSE; +- } ++ OPJ_UINT32 width = l_img_comp_dest->w; ++ OPJ_UINT32 height = l_img_comp_dest->h; ++ const OPJ_UINT32 MAX_SIZE = UINT32_MAX / sizeof(OPJ_INT32); ++ if (height == 0 || width > MAX_SIZE / height) { ++ return OPJ_FALSE; ++ } ++ l_img_comp_dest->data = (OPJ_INT32*)opj_calloc(width * height, sizeof(OPJ_INT32)); ++ if (!l_img_comp_dest->data) { ++ return OPJ_FALSE; ++ } + } + + /* Copy info from decoded comp image to output image */ |