From 7cc20e98504730a361d8589fff382bc9b9b770e9 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Wed, 3 Feb 2016 14:54:13 -0800 Subject: Merge to M48: openjpeg: Set proper upper bound for an array in opj_pi_update_decode_poc(). TBR=thestig@chromium.org BUG=571480 Review URL: https://codereview.chromium.org/1583233008 . (cherry picked from commit 7a0f441e1410b3a0d97374c00c4007552d7dd27a) Review URL: https://codereview.chromium.org/1666553003 . --- third_party/libopenjpeg20/0010-pi_update_decode_poc.patch | 13 +++++++++++++ third_party/libopenjpeg20/pi.c | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 third_party/libopenjpeg20/0010-pi_update_decode_poc.patch diff --git a/third_party/libopenjpeg20/0010-pi_update_decode_poc.patch b/third_party/libopenjpeg20/0010-pi_update_decode_poc.patch new file mode 100644 index 0000000000..d596b76b8f --- /dev/null +++ b/third_party/libopenjpeg20/0010-pi_update_decode_poc.patch @@ -0,0 +1,13 @@ +diff --git a/third_party/libopenjpeg20/pi.c b/third_party/libopenjpeg20/pi.c +index 462e07c..9097e31 100644 +--- a/third_party/libopenjpeg20/pi.c ++++ b/third_party/libopenjpeg20/pi.c +@@ -1028,7 +1028,7 @@ static void opj_pi_update_decode_poc (opj_pi_iterator_t * p_pi, + l_current_pi->poc.precno0 = 0; + l_current_pi->poc.resno1 = l_current_poc->resno1; /* Resolution Level Index #0 (End) */ + l_current_pi->poc.compno1 = l_current_poc->compno1; /* Component Index #0 (End) */ +- l_current_pi->poc.layno1 = l_current_poc->layno1; /* Layer Index #0 (End) */ ++ l_current_pi->poc.layno1 = opj_uint_min(l_current_poc->layno1, p_tcp->numlayers); /* Layer Index #0 (End) */ + l_current_pi->poc.precno1 = p_max_precision; + ++l_current_pi; + ++l_current_poc; diff --git a/third_party/libopenjpeg20/pi.c b/third_party/libopenjpeg20/pi.c index 06f1e41157..da954804ee 100644 --- a/third_party/libopenjpeg20/pi.c +++ b/third_party/libopenjpeg20/pi.c @@ -1019,7 +1019,7 @@ static void opj_pi_update_decode_poc (opj_pi_iterator_t * p_pi, l_current_pi->poc.precno0 = 0; l_current_pi->poc.resno1 = l_current_poc->resno1; /* Resolution Level Index #0 (End) */ l_current_pi->poc.compno1 = l_current_poc->compno1; /* Component Index #0 (End) */ - l_current_pi->poc.layno1 = l_current_poc->layno1; /* Layer Index #0 (End) */ + l_current_pi->poc.layno1 = opj_uint_min(l_current_poc->layno1, p_tcp->numlayers); /* Layer Index #0 (End) */ l_current_pi->poc.precno1 = p_max_precision; ++l_current_pi; ++l_current_poc; -- cgit v1.2.3