summaryrefslogtreecommitdiff
path: root/third_party/libopenjpeg20/j2k.c
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-01 17:44:48 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-01 17:44:48 +0000
commit0fa150a12267b69abcfe5e380b698bbbbd37d5de (patch)
tree0c6d5c396bb4fdf875271fe65c63ac7752ba5f49 /third_party/libopenjpeg20/j2k.c
parentb9e6281b72cd2ae51fd2d320430fba9c1f63fd2f (diff)
downloadpdfium-0fa150a12267b69abcfe5e380b698bbbbd37d5de.tar.xz
Fix assertion in opj_j2k_merge_ppt().
This patches in: https://github.com/uclouvain/openjpeg/commit/832dfd18 https://github.com/uclouvain/openjpeg/commit/0c913b0a Also clean up a duplicate patch number and update README.pdfium. BUG=chromium:614691 Change-Id: I282abfe227e2f667418e5d9058e96e253b220de7 Reviewed-on: https://pdfium-review.googlesource.com/39352 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'third_party/libopenjpeg20/j2k.c')
-rw-r--r--third_party/libopenjpeg20/j2k.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/third_party/libopenjpeg20/j2k.c b/third_party/libopenjpeg20/j2k.c
index cea6147096..afcd597ee0 100644
--- a/third_party/libopenjpeg20/j2k.c
+++ b/third_party/libopenjpeg20/j2k.c
@@ -4085,7 +4085,12 @@ static OPJ_BOOL opj_j2k_merge_ppt(opj_tcp_t *p_tcp, opj_event_mgr_t * p_manager)
/* preconditions */
assert(p_tcp != 00);
assert(p_manager != 00);
- assert(p_tcp->ppt_buffer == NULL);
+
+ if (p_tcp->ppt_buffer != NULL) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "opj_j2k_merge_ppt() has already been called\n");
+ return OPJ_FALSE;
+ }
if (p_tcp->ppt == 0U) {
return OPJ_TRUE;
@@ -8836,7 +8841,10 @@ OPJ_BOOL opj_j2k_read_tile_header(opj_j2k_t * p_j2k,
/* Current marker is the EOC marker ?*/
if (l_current_marker == J2K_MS_EOC) {
- p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
+ if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
+ p_j2k->m_current_tile_number = 0;
+ p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
+ }
}
/* FIXME DOC ???*/