|
|
04f45e |
diff --git a/src/bin/jp2/convertpng.c b/src/bin/jp2/convertpng.c
|
|
|
709b83 |
index 00f596e..af3f91e 100644
|
|
|
04f45e |
--- a/src/bin/jp2/convertpng.c
|
|
|
04f45e |
+++ b/src/bin/jp2/convertpng.c
|
|
|
04f45e |
@@ -75,10 +75,10 @@ opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params)
|
|
|
04f45e |
png_uint_32 width, height = 0U;
|
|
|
04f45e |
int color_type;
|
|
|
04f45e |
FILE *reader = NULL;
|
|
|
04f45e |
- OPJ_BYTE** rows = NULL;
|
|
|
04f45e |
- OPJ_INT32* row32s = NULL;
|
|
|
04f45e |
+ OPJ_BYTE** volatile rows = NULL;
|
|
|
04f45e |
+ OPJ_INT32* volatile row32s = NULL;
|
|
|
04f45e |
/* j2k: */
|
|
|
04f45e |
- opj_image_t *image = NULL;
|
|
|
04f45e |
+ opj_image_t* volatile image = NULL;
|
|
|
04f45e |
opj_image_cmptparm_t cmptparm[4];
|
|
|
04f45e |
OPJ_UINT32 nr_comp;
|
|
|
04f45e |
OPJ_BYTE sigbuf[8];
|
|
|
04f45e |
diff --git a/src/bin/jp2/converttif.c b/src/bin/jp2/converttif.c
|
|
|
709b83 |
index 9d1037a..8d5002a 100644
|
|
|
04f45e |
--- a/src/bin/jp2/converttif.c
|
|
|
04f45e |
+++ b/src/bin/jp2/converttif.c
|
|
|
709b83 |
@@ -720,7 +720,7 @@ int imagetotif(opj_image_t * image, const char *outfile)
|
|
|
04f45e |
TIFFClose(tif);
|
|
|
04f45e |
return 1;
|
|
|
04f45e |
}
|
|
|
04f45e |
- rowStride = (int64_t)((width * numcomps * bps + 7U) / 8U);
|
|
|
04f45e |
+ rowStride = ((int64_t)width * numcomps * bps + 7U) / 8U;
|
|
|
04f45e |
if (rowStride != strip_size) {
|
|
|
04f45e |
fprintf(stderr, "Invalid TIFF strip size\n");
|
|
|
04f45e |
TIFFClose(tif);
|
|
|
709b83 |
@@ -1283,8 +1283,6 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
|
|
04f45e |
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &tiSpp);
|
|
|
04f45e |
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &tiPhoto);
|
|
|
04f45e |
TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &tiPC);
|
|
|
04f45e |
- w = (int)tiWidth;
|
|
|
04f45e |
- h = (int)tiHeight;
|
|
|
04f45e |
|
|
|
04f45e |
if (tiSpp == 0 || tiSpp > 4) { /* should be 1 ... 4 */
|
|
|
04f45e |
fprintf(stderr, "tiftoimage: Bad value for samples per pixel == %d.\n"
|
|
|
709b83 |
@@ -1451,7 +1449,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
|
|
04f45e |
return NULL;
|
|
|
04f45e |
}
|
|
|
04f45e |
|
|
|
04f45e |
- rowStride = (int64_t)((tiWidth * tiSpp * tiBps + 7U) / 8U);
|
|
|
04f45e |
+ rowStride = ((int64_t)tiWidth * tiSpp * tiBps + 7U) / 8U;
|
|
|
04f45e |
buffer32s = (OPJ_INT32 *)malloc(sizeof(OPJ_INT32) * tiWidth * tiSpp);
|
|
|
04f45e |
if (buffer32s == NULL) {
|
|
|
04f45e |
_TIFFfree(buf);
|
|
|
709b83 |
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c
|
|
|
709b83 |
index 8e343ab..c13d229 100644
|
|
|
709b83 |
--- a/src/lib/openjp2/j2k.c
|
|
|
709b83 |
+++ b/src/lib/openjp2/j2k.c
|
|
|
709b83 |
@@ -7075,7 +7075,7 @@ static OPJ_BOOL opj_j2k_is_imf_compliant(opj_cparameters_t *parameters,
|
|
|
709b83 |
/* Validate sublevel */
|
|
|
709b83 |
assert(sizeof(tabMaxSubLevelFromMainLevel) ==
|
|
|
709b83 |
(OPJ_IMF_MAINLEVEL_MAX + 1) * sizeof(tabMaxSubLevelFromMainLevel[0]));
|
|
|
709b83 |
- if (sublevel > tabMaxSubLevelFromMainLevel[mainlevel]) {
|
|
|
709b83 |
+ if (mainlevel <= OPJ_IMF_MAINLEVEL_MAX && sublevel > tabMaxSubLevelFromMainLevel[mainlevel]) {
|
|
|
709b83 |
opj_event_msg(p_manager, EVT_WARNING,
|
|
|
709b83 |
"IMF profile require sublevel <= %d for mainlevel = %d.\n"
|
|
|
709b83 |
"-> %d is thus not compliant\n"
|
|
|
709b83 |
diff --git a/src/lib/openjp2/t2.c b/src/lib/openjp2/t2.c
|
|
|
709b83 |
index 1481e16..d46bfb4 100644
|
|
|
709b83 |
--- a/src/lib/openjp2/t2.c
|
|
|
709b83 |
+++ b/src/lib/openjp2/t2.c
|
|
|
709b83 |
@@ -821,6 +821,7 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
|
|
|
709b83 |
opj_event_msg(p_manager, EVT_ERROR,
|
|
|
709b83 |
"opj_t2_encode_packet(): accessing precno=%u >= %u\n",
|
|
|
709b83 |
precno, res->pw * res->ph);
|
|
|
709b83 |
+ opj_bio_destroy(bio);
|
|
|
709b83 |
return OPJ_FALSE;
|
|
|
709b83 |
}
|
|
|
709b83 |
|