summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGautam Ramakrishnan <gautamramk@gmail.com>2020-07-14 22:13:13 +0530
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-14 22:05:02 +0200
commit05f3d37dd58b1626c8e587cdf11af5a0ab65d377 (patch)
treee2cfb8d387df5288373cbce9595580420b3eb89d
parent24c575e0aa6b469eeaa1bd8f7ffc0fe6732495d0 (diff)
libavcodec/jpeg2000dec : Prevent overriding SOP marker bit
Currently, the COC marker overrides the SOP marker bit. However, only the COD marker may set this value. This patch fixes this bug. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/jpeg2000dec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 18a933077e..48ca1c37a5 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -588,7 +588,7 @@ static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
uint8_t *properties)
{
int compno, ret;
- uint8_t has_eph;
+ uint8_t has_eph, has_sop;
if (bytestream2_get_bytes_left(&s->g) < 2) {
av_log(s->avctx, AV_LOG_ERROR, "Insufficient space for COC\n");
@@ -606,8 +606,10 @@ static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
c += compno;
has_eph = c->csty & JPEG2000_CSTY_EPH;
+ has_sop = c->csty & JPEG2000_CSTY_SOP;
c->csty = bytestream2_get_byteu(&s->g);
c->csty |= has_eph; //do not override eph present bits from COD
+ c->csty |= has_sop; //do not override sop present bits from COD
if ((ret = get_cox(s, c)) < 0)
return ret;