aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Anthony Lemieux <pal@palemieux.com>2024-10-24 16:28:38 -0700
committerPierre-Anthony Lemieux <pal@palemieux.com>2024-10-27 10:26:00 -0700
commit839f6d38a0ff32d8fb89fc1f1b281ed874ae3543 (patch)
tree8bb3433626d7c2114606c183087355e22c72f5f6
parent562524587ea80c1b5f6a91b86b53e06d799e5667 (diff)
downloadffmpeg-839f6d38a0ff32d8fb89fc1f1b281ed874ae3543.tar.gz
jpeg2000dec: fix tile-part header state reset
Fixes https://trac.ffmpeg.org/ticket/11266
-rw-r--r--libavcodec/jpeg2000dec.c19
-rw-r--r--libavcodec/jpeg2000dec.h1
2 files changed, 10 insertions, 10 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 2e09b279dc..5b05ff2455 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2402,6 +2402,7 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
Jpeg2000QuantStyle *qntsty = s->qntsty;
Jpeg2000POC *poc = &s->poc;
uint8_t *properties = s->properties;
+ uint8_t in_tile_headers = 0;
for (;;) {
int len, ret = 0;
@@ -2484,7 +2485,7 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
ret = get_cap(s, codsty);
break;
case JPEG2000_COC:
- if (s->in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
+ if (in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
av_log(s->avctx, AV_LOG_ERROR,
"COC marker found in a tile header but the codestream belongs to the HOMOGENEOUS set\n");
return AVERROR_INVALIDDATA;
@@ -2492,7 +2493,7 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
ret = get_coc(s, codsty, properties);
break;
case JPEG2000_COD:
- if (s->in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
+ if (in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
av_log(s->avctx, AV_LOG_ERROR,
"COD marker found in a tile header but the codestream belongs to the HOMOGENEOUS set\n");
return AVERROR_INVALIDDATA;
@@ -2500,7 +2501,7 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
ret = get_cod(s, codsty, properties);
break;
case JPEG2000_RGN:
- if (s->in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
+ if (in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
av_log(s->avctx, AV_LOG_ERROR,
"RGN marker found in a tile header but the codestream belongs to the HOMOGENEOUS set\n");
return AVERROR_INVALIDDATA;
@@ -2512,7 +2513,7 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
}
break;
case JPEG2000_QCC:
- if (s->in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
+ if (in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
av_log(s->avctx, AV_LOG_ERROR,
"QCC marker found in a tile header but the codestream belongs to the HOMOGENEOUS set\n");
return AVERROR_INVALIDDATA;
@@ -2520,7 +2521,7 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
ret = get_qcc(s, len, qntsty, properties);
break;
case JPEG2000_QCD:
- if (s->in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
+ if (in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
av_log(s->avctx, AV_LOG_ERROR,
"QCD marker found in a tile header but the codestream belongs to the HOMOGENEOUS set\n");
return AVERROR_INVALIDDATA;
@@ -2528,7 +2529,7 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
ret = get_qcd(s, len, qntsty, properties);
break;
case JPEG2000_POC:
- if (s->in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
+ if (in_tile_headers == 1 && s->isHT && (!s->Ccap15_b11)) {
av_log(s->avctx, AV_LOG_ERROR,
"POC marker found in a tile header but the codestream belongs to the HOMOGENEOUS set\n");
return AVERROR_INVALIDDATA;
@@ -2536,8 +2537,8 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
ret = get_poc(s, len, poc);
break;
case JPEG2000_SOT:
- if (!s->in_tile_headers) {
- s->in_tile_headers = 1;
+ if (!in_tile_headers) {
+ in_tile_headers = 1;
if (s->has_ppm) {
bytestream2_init(&s->packed_headers_stream, s->packed_headers, s->packed_headers_size);
}
@@ -2569,7 +2570,7 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
break;
case JPEG2000_PPM:
// Packed headers, main header
- if (s->in_tile_headers) {
+ if (in_tile_headers) {
av_log(s->avctx, AV_LOG_ERROR, "PPM Marker can only be in Main header\n");
return AVERROR_INVALIDDATA;
}
diff --git a/libavcodec/jpeg2000dec.h b/libavcodec/jpeg2000dec.h
index 78eba27ed9..fce3823164 100644
--- a/libavcodec/jpeg2000dec.h
+++ b/libavcodec/jpeg2000dec.h
@@ -86,7 +86,6 @@ typedef struct Jpeg2000DecoderContext {
uint8_t *packed_headers; // contains packed headers. Used only along with PPM marker
int packed_headers_size;
GetByteContext packed_headers_stream;
- uint8_t in_tile_headers;
int cdx[4], cdy[4];
int precision;