Commit cf48b006 authored by Michael Niedermayer's avatar Michael Niedermayer

cavsdec: check for value in get_ue_code()

Fixes integer overflow and prints an error in case the value is
invalid.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 77b740ac
......@@ -510,11 +510,15 @@ static inline void mv_pred_sym(AVSContext *h, cavs_vector *src,
/** kth-order exponential golomb code */
static inline int get_ue_code(GetBitContext *gb, int order)
{
unsigned ret = get_ue_golomb(gb);
if (ret >= ((1U<<31)>>order)) {
av_log(NULL, AV_LOG_ERROR, "get_ue_code: value too larger\n");
return AVERROR_INVALIDDATA;
}
if (order) {
int ret = get_ue_golomb(gb) << order;
return ret + get_bits(gb, order);
return (ret<<order) + get_bits(gb, order);
}
return get_ue_golomb(gb);
return ret;
}
static inline int dequant(AVSContext *h, int16_t *level_buf, uint8_t *run_buf,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment