You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
cavsdec: check for value in get_ue_code()
Fixes integer overflow and prints an error in case the value is invalid. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -510,11 +510,15 @@ static inline void mv_pred_sym(AVSContext *h, cavs_vector *src,
|
|||||||
/** kth-order exponential golomb code */
|
/** kth-order exponential golomb code */
|
||||||
static inline int get_ue_code(GetBitContext *gb, int order)
|
static inline int get_ue_code(GetBitContext *gb, int order)
|
||||||
{
|
{
|
||||||
if (order) {
|
unsigned ret = get_ue_golomb(gb);
|
||||||
int ret = get_ue_golomb(gb) << order;
|
if (ret >= ((1U<<31)>>order)) {
|
||||||
return ret + get_bits(gb, order);
|
av_log(NULL, AV_LOG_ERROR, "get_ue_code: value too larger\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
return get_ue_golomb(gb);
|
if (order) {
|
||||||
|
return (ret<<order) + get_bits(gb, order);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int dequant(AVSContext *h, int16_t *level_buf, uint8_t *run_buf,
|
static inline int dequant(AVSContext *h, int16_t *level_buf, uint8_t *run_buf,
|
||||||
|
Reference in New Issue
Block a user