[trunk] JP3D: Handles errors properly

This commit is contained in:
Mathieu Malaterre 2013-01-03 14:25:49 +00:00
parent ad1532ed57
commit 44fb38949b
2 changed files with 2 additions and 0 deletions

View File

@ -58,6 +58,7 @@ opj_cio_t* OPJ_CALLCONV opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer
cio->length = cp->tdx * cp->tdy * cp->tdz * cp->tw * cp->th * cp->tl * 4; cio->length = cp->tdx * cp->tdy * cp->tdz * cp->tw * cp->th * cp->tl * 4;
cio->buffer = (unsigned char *)opj_malloc(cio->length); cio->buffer = (unsigned char *)opj_malloc(cio->length);
if(!cio->buffer) { if(!cio->buffer) {
opj_event_msg(cio->cinfo, EVT_ERROR, "Error allocating memory for compressed bitstream\n");
opj_free(cio); opj_free(cio);
return NULL; return NULL;
} }

View File

@ -479,6 +479,7 @@ int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *
if (tcp->csty & J3D_CP_CSTY_EPH) { if (tcp->csty & J3D_CP_CSTY_EPH) {
if ((*hd) != 0xff || (*(hd + 1) != 0x92)) { if ((*hd) != 0xff || (*(hd + 1) != 0x92)) {
opj_event_msg(t2->cinfo, EVT_ERROR, "Expected EPH marker\n"); opj_event_msg(t2->cinfo, EVT_ERROR, "Expected EPH marker\n");
return -999;
} else { } else {
hd += 2; hd += 2;
} }