diff --git a/src/lib/openjp2/mct.c b/src/lib/openjp2/mct.c index 5e933ce5..d2754dc2 100644 --- a/src/lib/openjp2/mct.c +++ b/src/lib/openjp2/mct.c @@ -230,7 +230,7 @@ OPJ_BOOL opj_mct_encode_custom( lCurrentMatrix = lCurrentData + pNbComp; for (i =0;ibp - raw->start; + const ptrdiff_t diff = raw->bp - raw->start; + assert( diff <= 0xffffffff && diff >= 0 ); /* UINT32_MAX */ + return (OPJ_UINT32)diff; } void opj_raw_init_dec(opj_raw_t *raw, OPJ_BYTE *bp, OPJ_UINT32 len) { diff --git a/src/lib/openjp2/tgt.c b/src/lib/openjp2/tgt.c index 6fd85587..81b05482 100644 --- a/src/lib/openjp2/tgt.c +++ b/src/lib/openjp2/tgt.c @@ -87,7 +87,7 @@ opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv) { return 00; } memset(tree->nodes,0,tree->numnodes * sizeof(opj_tgt_node_t)); - tree->nodes_size = tree->numnodes * sizeof(opj_tgt_node_t); + tree->nodes_size = tree->numnodes * (OPJ_UINT32)sizeof(opj_tgt_node_t); node = tree->nodes; l_parent_node = &tree->nodes[tree->numleafsh * tree->numleafsv]; @@ -166,7 +166,7 @@ opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,OPJ_UINT32 p_num_leafs_h, O opj_tgt_destroy(p_tree); return 00; } - l_node_size = p_tree->numnodes * sizeof(opj_tgt_node_t); + l_node_size = p_tree->numnodes * (OPJ_UINT32)sizeof(opj_tgt_node_t); if (l_node_size > p_tree->nodes_size) { opj_tgt_node_t* new_nodes = (opj_tgt_node_t*) opj_realloc(p_tree->nodes, l_node_size);