summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/sparse_array.c
diff options
context:
space:
mode:
authorEric Harvey <71228603+Eharve14@users.noreply.github.com>2022-01-18 15:55:10 -0500
committerGitHub <noreply@github.com>2022-01-18 21:55:10 +0100
commit241e9e8efeb6750ef4202a61b3a436628e4f6d23 (patch)
tree9a38bc9eb12cc5aa485f0ecec940c9fff3e7d341 /src/lib/openjp2/sparse_array.c
parentd87fd9279a9e0f8ce8fb23ab10e536410a907336 (diff)
Fix potential overflow related issues spotted by LGTM code analysis (#1402)
Diffstat (limited to 'src/lib/openjp2/sparse_array.c')
-rw-r--r--src/lib/openjp2/sparse_array.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/openjp2/sparse_array.c b/src/lib/openjp2/sparse_array.c
index 73192924..50d1a904 100644
--- a/src/lib/openjp2/sparse_array.c
+++ b/src/lib/openjp2/sparse_array.c
@@ -69,7 +69,7 @@ opj_sparse_array_int32_t* opj_sparse_array_int32_create(OPJ_UINT32 width,
return NULL;
}
sa->data_blocks = (OPJ_INT32**) opj_calloc(sizeof(OPJ_INT32*),
- sa->block_count_hor * sa->block_count_ver);
+ (size_t) sa->block_count_hor * sa->block_count_ver);
if (sa->data_blocks == NULL) {
opj_free(sa);
return NULL;
@@ -235,7 +235,7 @@ static OPJ_BOOL opj_sparse_array_int32_read_or_write(
} else {
if (src_block == NULL) {
src_block = (OPJ_INT32*) opj_calloc(1,
- sa->block_width * sa->block_height * sizeof(OPJ_INT32));
+ (size_t) sa->block_width * sa->block_height * sizeof(OPJ_INT32));
if (src_block == NULL) {
return OPJ_FALSE;
}