Re: [FFmpeg-devel] [PATCH v3] avcodec/jpeg2000dec: error check when processing tlm marker

2020-03-27 Thread Michael Niedermayer
On Thu, Mar 26, 2020 at 10:24:36AM +0530, gautamr...@gmail.com wrote:
> From: Gautam Ramakrishnan 
> 
> Validate the value of ST field in the TLM marker of JPEG2000.
> Throw an error when ST takes value of 0b11.
> ---
>  libavcodec/jpeg2000dec.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

will apply

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v3] avcodec/jpeg2000dec: error check when processing tlm marker

2020-03-25 Thread gautamramk
From: Gautam Ramakrishnan 

Validate the value of ST field in the TLM marker of JPEG2000.
Throw an error when ST takes value of 0b11.
---
 libavcodec/jpeg2000dec.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 019dc81f56..7103cd6ceb 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -795,7 +795,7 @@ static int get_sot(Jpeg2000DecoderContext *s, int n)
  * markers. Parsing the TLM header is needed to increment the input header
  * buffer.
  * This marker is mandatory for DCI. */
-static uint8_t get_tlm(Jpeg2000DecoderContext *s, int n)
+static int get_tlm(Jpeg2000DecoderContext *s, int n)
 {
 uint8_t Stlm, ST, SP, tile_tlm, i;
 bytestream2_get_byte(&s->g);   /* Ztlm: skipped */
@@ -803,7 +803,11 @@ static uint8_t get_tlm(Jpeg2000DecoderContext *s, int n)
 
 // too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02);
 ST = (Stlm >> 4) & 0x03;
-// TODO: Manage case of ST = 0b11 --> raise error
+if (ST == 0x03) {
+av_log(s->avctx, AV_LOG_ERROR, "TLM marker contains invalid ST 
value.\n");
+return AVERROR_INVALIDDATA;
+}
+
 SP   = (Stlm >> 6) & 0x01;
 tile_tlm = (n - 4) / ((SP + 1) * 2 + ST);
 for (i = 0; i < tile_tlm; i++) {
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".