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

Michael Niedermayer michael at niedermayer.cc
Wed Mar 25 02:36:41 EET 2020


On Wed, Mar 25, 2020 at 01:06:15AM +0530, gautamramk at gmail.com wrote:
> From: Gautam Ramakrishnan <gautamramk at gmail.com>
> 
> Validate the value of ST field in the TLM marker of JPEG2000.
> Throw an error when ST takes value of 0x11.
> ---
>  libavcodec/jpeg2000dec.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> index 019dc81f56..74d70b686f 100644
> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -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 == 0x11) {
> +        av_log(s, AV_LOG_ERROR, "TLM marker contains invalid ST value.\n");

> +        return AVERROR_INVALIDDATA;

in addition to what paul said,

the return type of get_tlm() is unsigned 8bit the error code doesnt fit in 8bit


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The day soldiers stop bringing you their problems is the day you have stopped 
leading them. They have either lost confidence that you can help or concluded 
you do not care. Either case is a failure of leadership. - Colin Powell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200325/e0ab2621/attachment.sig>


More information about the ffmpeg-devel mailing list