summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000dec.c
diff options
context:
space:
mode:
authorGautam Ramakrishnan <gautamramk@gmail.com>2020-04-11 12:10:08 +0530
committerMichael Niedermayer <michael@niedermayer.cc>2020-04-11 18:15:58 +0200
commite8344f21e16b7043411830cea99304169127dacf (patch)
tree68489609cc2e452aff9bc1339ad2426620383765 /libavcodec/jpeg2000dec.c
parent12a5e0409d32105b7ae3346cf2cdf83b40ab33b2 (diff)
libavcodec/jpeg2000dec.c: fix error in cod marker
This patch fixes an error where the COC marker overrides all data of the SPcod field of the COD marker. It must override only one bit of SPcod field. This now allows p0_08.j2k to be decoded correctly (mentioned in #4679). Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/jpeg2000dec.c')
-rw-r--r--libavcodec/jpeg2000dec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 9684e57b34..7196cba6b4 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -566,6 +566,7 @@ static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
uint8_t *properties)
{
int compno, ret;
+ uint8_t has_eph;
if (bytestream2_get_bytes_left(&s->g) < 2) {
av_log(s->avctx, AV_LOG_ERROR, "Insufficient space for COC\n");
@@ -582,7 +583,9 @@ static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
}
c += compno;
+ has_eph = c->csty & JPEG2000_CSTY_EPH;
c->csty = bytestream2_get_byteu(&s->g);
+ c->csty |= has_eph; //do not override eph present bits from COD
if ((ret = get_cox(s, c)) < 0)
return ret;