mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 11:19:55 +00:00
rv34: Check for invalid slice offsets
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
c92a2a4eb8
commit
4cc7732386
@ -1488,8 +1488,9 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
|
||||
slice_count = avctx->slice_count;
|
||||
|
||||
//parse first slice header to check whether this frame can be decoded
|
||||
if(get_slice_offset(avctx, slices_hdr, 0) > buf_size){
|
||||
av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
|
||||
if(get_slice_offset(avctx, slices_hdr, 0) < 0 ||
|
||||
get_slice_offset(avctx, slices_hdr, 0) > buf_size){
|
||||
av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
|
||||
return -1;
|
||||
}
|
||||
init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), (buf_size-get_slice_offset(avctx, slices_hdr, 0))*8);
|
||||
@ -1512,8 +1513,8 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
|
||||
else
|
||||
size = get_slice_offset(avctx, slices_hdr, i+1) - offset;
|
||||
|
||||
if(offset > buf_size){
|
||||
av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
|
||||
if(offset < 0 || offset > buf_size || size < 0){
|
||||
av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user