From 44fb38949bfce15ec44f53b5cc2e057d48f94563 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Thu, 3 Jan 2013 14:25:49 +0000 Subject: [PATCH] [trunk] JP3D: Handles errors properly --- src/lib/openjp3d/cio.c | 1 + src/lib/openjp3d/t2.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/lib/openjp3d/cio.c b/src/lib/openjp3d/cio.c index 10bd2af3..7b2c5e4e 100644 --- a/src/lib/openjp3d/cio.c +++ b/src/lib/openjp3d/cio.c @@ -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->buffer = (unsigned char *)opj_malloc(cio->length); if(!cio->buffer) { + opj_event_msg(cio->cinfo, EVT_ERROR, "Error allocating memory for compressed bitstream\n"); opj_free(cio); return NULL; } diff --git a/src/lib/openjp3d/t2.c b/src/lib/openjp3d/t2.c index 7fd551e5..65d98c13 100644 --- a/src/lib/openjp3d/t2.c +++ b/src/lib/openjp3d/t2.c @@ -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 ((*hd) != 0xff || (*(hd + 1) != 0x92)) { opj_event_msg(t2->cinfo, EVT_ERROR, "Expected EPH marker\n"); + return -999; } else { hd += 2; } -- 2.40.0