[FFmpeg-cvslog] avformat/cache: Use int64_t to avoid int overflow in cache_read

Bryan Huh git at videolan.org
Wed Nov 4 04:20:01 CET 2015


ffmpeg | branch: master | Bryan Huh <bryan at box.com> | Mon Nov  2 10:20:39 2015 -0800| [d917f25658c47b617420aa7a389cc354d6580ee4] | committer: Michael Niedermayer

avformat/cache: Use int64_t to avoid int overflow in cache_read

Fixes an issue where an int64_t ffurl_seek return-value was being stored
in an int (32-bit) "r" variable, leading to integer overflow when seeking
into a large file (>2GB), and ultimately a "Failed to perform internal
seek" error mesage.

To test, try running `ffprobe 'cache:http://<something>'` on a file that
is ~3GB large, whose moov atom is at the end of the file

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d917f25658c47b617420aa7a389cc354d6580ee4
---

 libavformat/cache.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/cache.c b/libavformat/cache.c
index a762aa9..31f63e6 100644
--- a/libavformat/cache.c
+++ b/libavformat/cache.c
@@ -156,7 +156,7 @@ static int cache_read(URLContext *h, unsigned char *buf, int size)
 {
     Context *c= h->priv_data;
     CacheEntry *entry, *next[2] = {NULL, NULL};
-    int r;
+    int64_t r;
 
     entry = av_tree_find(c->root, &c->logical_pos, cmp, (void**)next);
 



More information about the ffmpeg-cvslog mailing list