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) {
return OPJ_TRUE;
}
-static void j2k_add_mhmarker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len) {
-
- if (!cstr_info)
- return;
+static void j2k_add_mhmarker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len)
+{
+ assert(cstr_info != 00);
/* expand the list? */
if ((cstr_info->marknum + 1) > cstr_info->maxmarknum) {
}
-static void j2k_add_mhmarker_v2(opj_codestream_index_t *cstr_index, OPJ_UINT32 type, OPJ_OFF_T pos, OPJ_UINT32 len) {
-
- if (!cstr_index)
- return;
+static void j2k_add_mhmarker_v2(opj_codestream_index_t *cstr_index, OPJ_UINT32 type, OPJ_OFF_T pos, OPJ_UINT32 len)
+{
+ assert(cstr_index != 00);
/* expand the list? */
if ((cstr_index->marknum + 1) > cstr_index->maxmarknum) {
}
-static void j2k_add_tlmarker( int tileno, opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len) {
-
-
- opj_marker_info_t *marker;
+static void j2k_add_tlmarker( int tileno, opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len)
+{
+ opj_marker_info_t *marker;
- if (!cstr_info)
- return;
+ assert(cstr_info != 00);
/* expand the list? */
if ((cstr_info->tile[tileno].marknum + 1) > cstr_info->tile[tileno].maxmarknum) {
static void j2k_add_tlmarker_v2(OPJ_UINT32 tileno, opj_codestream_index_t *cstr_index, OPJ_UINT32 type, OPJ_OFF_T pos, OPJ_UINT32 len)
{
-
- if (!cstr_index)
- return;
-
- if (!cstr_index->tile_index)
+ assert(cstr_index != 00);
+ assert(cstr_index->tile_index != 00);
/* expand the list? */
if ((cstr_index->tile_index[tileno].marknum + 1) > cstr_index->tile_index[tileno].maxmarknum) {
cstr_index->tile_index[tileno].tp_index[l_current_tile_part].start_pos = pos;
}
-
}
-
-
/*
* -----------------------------------------------------------------------
* -----------------------------------------------------------------------