Commit 502d6c0a authored by Baptiste Coudurier's avatar Baptiste Coudurier

Change find_tag return type to int64_t, fix a bug

where size is negative and url_fseek then seek backward
causing infinite loop. This also support 4gb unsigned size.

Originally committed as revision 19083 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent f4ebb334
...@@ -118,11 +118,10 @@ static int wav_write_trailer(AVFormatContext *s) ...@@ -118,11 +118,10 @@ static int wav_write_trailer(AVFormatContext *s)
#endif /* CONFIG_WAV_MUXER */ #endif /* CONFIG_WAV_MUXER */
/* return the size of the found tag */ /* return the size of the found tag */
/* XXX: > 2GB ? */ static int64_t find_tag(ByteIOContext *pb, uint32_t tag1)
static int find_tag(ByteIOContext *pb, uint32_t tag1)
{ {
unsigned int tag; unsigned int tag;
int size; int64_t size;
for(;;) { for(;;) {
if (url_feof(pb)) if (url_feof(pb))
...@@ -133,8 +132,6 @@ static int find_tag(ByteIOContext *pb, uint32_t tag1) ...@@ -133,8 +132,6 @@ static int find_tag(ByteIOContext *pb, uint32_t tag1)
break; break;
url_fseek(pb, size, SEEK_CUR); url_fseek(pb, size, SEEK_CUR);
} }
if (size < 0)
size = 0x7fffffff;
return size; return size;
} }
...@@ -161,7 +158,7 @@ static int wav_probe(AVProbeData *p) ...@@ -161,7 +158,7 @@ static int wav_probe(AVProbeData *p)
static int wav_read_header(AVFormatContext *s, static int wav_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
int size; int64_t size;
unsigned int tag; unsigned int tag;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
AVStream *st; AVStream *st;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment