summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMickael Savinaud <savmickael@users.noreply.github.com>2012-03-02 10:38:01 +0000
committerMickael Savinaud <savmickael@users.noreply.github.com>2012-03-02 10:38:01 +0000
commitc149db2205efdb7dff507836365bf381af12f8d8 (patch)
treeeadd8fab7a1cfb09ecb88593723b0404e0a67b38
parentb5495ec972deb391605a48d565fa7cc068c8d05e (diff)
[trunk] check the PSot value during the reading of SOT marker
-rw-r--r--libopenjpeg/j2k.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c
index 0b0731d4..1fa975d9 100644
--- a/libopenjpeg/j2k.c
+++ b/libopenjpeg/j2k.c
@@ -3627,6 +3627,14 @@ opj_bool j2k_read_sot_v2 (
opj_read_bytes(p_header_data,&l_tot_len,4); /* Psot */
p_header_data+=4;
+ /* PSot should be equal to zero or >=14 or <= 2^32-1 */
+ if ((l_tot_len !=0 ) && (l_tot_len < 14) )
+ {
+ opj_event_msg_v2(p_manager, EVT_ERROR, "Psot value (%d) is not correct regards to the JPEG2000 norm!\n", l_tot_len);
+ return OPJ_FALSE;
+ }
+
+
#ifdef USE_JPWL
if (l_cp->correct) {