do not try to access data pointed to by mqc bp until it reaches the start of the mqc buffer

This commit is contained in:
Aaron Boxer 2016-01-13 22:42:51 -05:00
parent 1b86fb6f48
commit 5b7c4445e8
1 changed files with 1 additions and 1 deletions

View File

@ -203,7 +203,7 @@ static opj_mqc_state_t mqc_states[47 * 2] = {
*/ */
static void opj_mqc_byteout(opj_mqc_t *mqc) { static void opj_mqc_byteout(opj_mqc_t *mqc) {
if (*mqc->bp == 0xff) { if ( (mqc->bp >= mqc->start) & (*mqc->bp == 0xff)) {
mqc->bp++; mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 20); *mqc->bp = (OPJ_BYTE)(mqc->c >> 20);
mqc->c &= 0xfffff; mqc->c &= 0xfffff;