]> granicus.if.org Git - openjpeg/commitdiff
[trunk] check the PSot value during the reading of SOT marker
authorMickael Savinaud <savmickael@users.noreply.github.com>
Fri, 2 Mar 2012 10:38:01 +0000 (10:38 +0000)
committerMickael Savinaud <savmickael@users.noreply.github.com>
Fri, 2 Mar 2012 10:38:01 +0000 (10:38 +0000)
libopenjpeg/j2k.c

index 0b0731d4f081d8fc21bfe081f2aabde6bf1b0c5a..1fa975d9211eeb5a14f952ff7b2ac8673f2ef895 100644 (file)
@@ -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) {