From 5b7c4445e83addf3d56d297a645bfd1ed0f25923 Mon Sep 17 00:00:00 2001 From: Aaron Boxer Date: Wed, 13 Jan 2016 22:42:51 -0500 Subject: [PATCH] do not try to access data pointed to by mqc bp until it reaches the start of the mqc buffer --- src/lib/openjp2/mqc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/openjp2/mqc.c b/src/lib/openjp2/mqc.c index 7e0f5637..433ea8e2 100644 --- a/src/lib/openjp2/mqc.c +++ b/src/lib/openjp2/mqc.c @@ -203,7 +203,7 @@ static opj_mqc_state_t mqc_states[47 * 2] = { */ 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 = (OPJ_BYTE)(mqc->c >> 20); mqc->c &= 0xfffff;