diff options
| author | Stefan Weil <sw@weilnetz.de> | 2018-10-31 20:44:30 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@mines-paris.org> | 2018-10-31 20:44:30 +0100 |
| commit | 948332e6ed17565100d1df5f6fdbf66865218e36 (patch) | |
| tree | 8e38306366e69eef4da8827372d00cf2280ee55c /src/bin/jp2/convertbmp.c | |
| parent | e52909f4c7896c5efff3340d707c12d0df55d3f9 (diff) | |
Fix some potential overflow issues (#1161)
* Fix some potential overflow issues
Put sizeof to the beginning of the multiplication to enforce that
size_t instead of smaller integer types is used for the calculation.
This fixes warnings from LGTM:
Multiplication result may overflow 'unsigned int'
before it is converted to 'unsigned long'.
It also allows removing some type casts.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix code indentation
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Diffstat (limited to 'src/bin/jp2/convertbmp.c')
| -rw-r--r-- | src/bin/jp2/convertbmp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/jp2/convertbmp.c b/src/bin/jp2/convertbmp.c index 7fde99ab..85a47fea 100644 --- a/src/bin/jp2/convertbmp.c +++ b/src/bin/jp2/convertbmp.c @@ -763,7 +763,7 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters) fclose(IN); return NULL; } - pData = (OPJ_UINT8 *) calloc(1, stride * Info_h.biHeight * sizeof(OPJ_UINT8)); + pData = (OPJ_UINT8 *) calloc(1, sizeof(OPJ_UINT8) * stride * Info_h.biHeight); if (pData == NULL) { fclose(IN); return NULL; |
