(no commit message)
[openjpeg.git] / libopenjpeg / cio.c
index cb0c3e4a3a14de2f2a09ee5cb4eb67797a561378..a462edb2d5642d93d35b5f422378dd3140171401 100644 (file)
@@ -58,7 +58,7 @@ opj_cio_t* OPJ_CALLCONV opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer
                                opj_free(cio);
                                return NULL;
                }
-               cio->length = (int) (0.1625 * cp->img_size); /* 0.1625 = 1.3/8 */
+               cio->length = (int) (0.1625 * cp->img_size + 2000); /* 0.1625 = 1.3/8 and 2000 bytes as a minimum for headers */
                cio->buffer = (unsigned char *)opj_malloc(cio->length);
                if(!cio->buffer) {
                        opj_free(cio);