]> granicus.if.org Git - openjpeg/commitdiff
[trunk] JP3D: Handles errors properly
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Thu, 3 Jan 2013 14:25:49 +0000 (14:25 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Thu, 3 Jan 2013 14:25:49 +0000 (14:25 +0000)
src/lib/openjp3d/cio.c
src/lib/openjp3d/t2.c

index 10bd2af329bbe9faf64f512f4cab4b68b95bf592..7b2c5e4e176edce2bfe879eeb507596029132cef 100644 (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->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;
                }
index 7fd551e56a334f5df116dd133c0f80174f3efc28..65d98c1337cf9d3655f78a4ff96cb4725071a7cf 100644 (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 ((*hd) != 0xff || (*(hd + 1) != 0x92)) {
                        opj_event_msg(t2->cinfo, EVT_ERROR, "Expected EPH marker\n");
+                       return -999;
                } else {
                        hd += 2;
                }