ffmdec: change type of len to ptrdiff_t

It is used to store the difference between pointers, so ptrdiff_t is the
correct type.

This prevents potential overflows.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
Andreas Cadhalpun 2016-01-02 16:32:09 +01:00
parent 63c9b30f98
commit f6e1c96730
1 changed files with 3 additions and 2 deletions

View File

@ -36,7 +36,7 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
{
FFMContext *ffm = s->priv_data;
int64_t pos, avail_size;
int len;
ptrdiff_t len;
len = ffm->packet_end - ffm->packet_ptr;
if (size <= len)
@ -87,8 +87,9 @@ static int ffm_read_data(AVFormatContext *s,
{
FFMContext *ffm = s->priv_data;
AVIOContext *pb = s->pb;
int len, fill_size, size1, frame_offset;
int fill_size, size1, frame_offset;
uint32_t id;
ptrdiff_t len;
int64_t last_pos = -1;
size1 = size;