[trunk] add a check on Zppm value in PPM markers (fixes issue 393)

This commit is contained in:
Antonin Descampe 2014-10-21 12:27:58 +00:00
parent 984351f86f
commit 413de4fbfa
1 changed files with 8 additions and 0 deletions

View File

@ -3554,6 +3554,14 @@ OPJ_BOOL j2k_read_ppm_v3 (
/* First PPM marker */
if (l_Z_ppm == 0) {
if (l_cp->ppm_data != NULL) {
opj_event_msg(p_manager, EVT_ERROR, "Zppm O already processed. Found twice.\n");
opj_free(l_cp->ppm_data);
l_cp->ppm_data = NULL;
l_cp->ppm_buffer = NULL;
l_cp->ppm = 0; /* do not use PPM */
return OPJ_FALSE;
}
/* We need now at least the Nppm^0 element */
if (p_header_size < 4) {
opj_event_msg(p_manager, EVT_ERROR, "Error reading PPM marker\n");