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);