[FFmpeg-devel] [PATCH V2] lavc/midivid: FIX CID 1456088

James Almer jamrial at gmail.com
Mon Dec 23 15:09:01 EET 2019


On 12/23/2019 9:31 AM, Zhong Li wrote:
> James Almer <jamrial at gmail.com> 于2019年12月22日周日 下午11:29写道:
>>
>> On 12/22/2019 12:26 PM, Zhong Li wrote:
>>> Signed-off-by: Zhong Li <zhongli_dev at 126.com>
>>> ---
>>>  libavcodec/midivid.c | 9 ++++++---
>>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c
>>> index 38465c5..3dac3f1 100644
>>> --- a/libavcodec/midivid.c
>>> +++ b/libavcodec/midivid.c
>>> @@ -63,17 +63,20 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext *avctx, AVFrame *frame)
>>>      if (intra_flag) {
>>>          nb_blocks = (avctx->width / 2) * (avctx->height / 2);
>>>      } else {
>>> -        int skip_linesize;
>>> +        int ret, skip_linesize;
>>>
>>>          nb_blocks = bytestream2_get_le32(gb);
>>>          skip_linesize = avctx->width >> 1;
>>>          mask_start = gb->buffer_start + bytestream2_tell(gb);
>>>          mask_size = (avctx->width >> 5) * (avctx->height >> 2);
>>>
>>> -        if (bytestream2_get_bytes_left(gb) < mask_size)
>>> +        ret = bytestream2_get_bytes_left(gb);
>>> +        if (ret < mask_size)
>>
>> What is this fixing?
> 
> Not fix. Just want to use same coding stytle as following.

Unless you need it to return a value, then no point in making this change.

Add the init_get_bits8() check only, and make it return ret as others
suggested. Also, the commit subject should be something like
"lavc/midivid: check return value of init_get_bits8()", and the CID
1456088 comment added further down in the commit message.


More information about the ffmpeg-devel mailing list