[FFmpeg-cvslog] ffmdec: change type of len to ptrdiff_t
Andreas Cadhalpun
git at videolan.org
Mon Jan 11 23:18:37 CET 2016
ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sat Jan 2 16:32:09 2016 +0100| [f6e1c96730ebbcebbd0341329d51d3d3a36b4fa1] | committer: Andreas Cadhalpun
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 at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f6e1c96730ebbcebbd0341329d51d3d3a36b4fa1
---
libavformat/ffmdec.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index f754895..41c518f 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -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;
More information about the ffmpeg-cvslog
mailing list