@ -181,9 +181,11 @@ static int cbs_vp8_bool_decoder_read_signed(
return 0 ;
return 0 ;
}
}
static int cbs_vp8_read_unsigned_le ( CodedBitstreamContext * ctx , GetBitContext * gbc ,
static int cbs_vp8_read_unsigned_le ( CodedBitstreamContext * ctx ,
int width , const char * name ,
GetBitContext * gbc , int width ,
const int * subscripts , uint32_t * write_to )
const char * name , const int * subscripts ,
uint32_t * write_to , uint32_t range_min ,
uint32_t range_max )
{
{
int32_t value ;
int32_t value ;
@ -200,6 +202,14 @@ static int cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx, GetBitContext *g
CBS_TRACE_READ_END ( ) ;
CBS_TRACE_READ_END ( ) ;
if ( value < range_min | | value > range_max ) {
av_log ( ctx - > log_ctx , AV_LOG_ERROR ,
" %s out of range: "
" % " PRIu32 " , but must be in [% " PRIu32 " ,% " PRIu32 " ]. \n " ,
name , value , range_min , range_max ) ;
return AVERROR_INVALIDDATA ;
}
* write_to = value ;
* write_to = value ;
return 0 ;
return 0 ;
}
}
@ -246,14 +256,15 @@ static int cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx, GetBitContext *g
do { \
do { \
uint32_t value ; \
uint32_t value ; \
CHECK ( cbs_vp8_read_unsigned_le ( ctx , rw , width , # name , \
CHECK ( cbs_vp8_read_unsigned_le ( ctx , rw , width , # name , \
SUBSCRIPTS ( subs , __VA_ARGS__ ) , & value ) ) ; \
SUBSCRIPTS ( subs , __VA_ARGS__ ) , & value , \
0 , MAX_UINT_BITS ( width ) ) ) ; \
current - > name = value ; \
current - > name = value ; \
} while ( 0 )
} while ( 0 )
# define fixed(width, name, value) \
# define fixed(width, name, value) \
do { \
do { \
uint32_t fixed_value ; \
uint32_t fixed_value ; \
CHECK ( ff_ cbs_read_unsigned( ctx , rw , width , # name , 0 , & fixed_value , \
CHECK ( cbs_vp8 _read_unsigned_le ( ctx , rw , width , # name , 0 , & fixed_value , \
value , value ) ) ; \
value , value ) ) ; \
} while ( 0 )
} while ( 0 )