mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
avcodec/jpeg2000dec: error check when processing tlm marker
Validate the value of ST field in the TLM marker of JPEG2000. Throw an error when ST takes value of 0b11. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
b71685865f
commit
26a36801c0
@ -795,7 +795,7 @@ static int get_sot(Jpeg2000DecoderContext *s, int n)
|
|||||||
* markers. Parsing the TLM header is needed to increment the input header
|
* markers. Parsing the TLM header is needed to increment the input header
|
||||||
* buffer.
|
* buffer.
|
||||||
* This marker is mandatory for DCI. */
|
* 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;
|
uint8_t Stlm, ST, SP, tile_tlm, i;
|
||||||
bytestream2_get_byte(&s->g); /* Ztlm: skipped */
|
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);
|
// too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02);
|
||||||
ST = (Stlm >> 4) & 0x03;
|
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;
|
SP = (Stlm >> 6) & 0x01;
|
||||||
tile_tlm = (n - 4) / ((SP + 1) * 2 + ST);
|
tile_tlm = (n - 4) / ((SP + 1) * 2 + ST);
|
||||||
for (i = 0; i < tile_tlm; i++) {
|
for (i = 0; i < tile_tlm; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user