mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-26 08:23:10 +00:00
10l: now it works really, with 1k outbut buffers it failed more times, with 65k it looks safe with all samples i had
Originally committed as revision 4861 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
29a10be0d4
commit
0c2ed2df5a
13
cws2fws.c
13
cws2fws.c
@ -19,7 +19,7 @@
|
|||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int fd_in, fd_out, comp_len, uncomp_len, tag, i, last_out;
|
int fd_in, fd_out, comp_len, uncomp_len, tag, i, last_out;
|
||||||
char buf_in[1024], buf_out[1024];
|
char buf_in[1024], buf_out[65536];
|
||||||
z_stream zstream;
|
z_stream zstream;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ main(int argc, char *argv[])
|
|||||||
zstream.opaque = NULL;
|
zstream.opaque = NULL;
|
||||||
inflateInit(&zstream);
|
inflateInit(&zstream);
|
||||||
|
|
||||||
for (i = 0; i < comp_len-4;)
|
for (i = 0; i < comp_len-8;)
|
||||||
{
|
{
|
||||||
int ret, len = read(fd_in, &buf_in, 1024);
|
int ret, len = read(fd_in, &buf_in, 1024);
|
||||||
|
|
||||||
@ -84,12 +84,10 @@ main(int argc, char *argv[])
|
|||||||
zstream.next_in = &buf_in[0];
|
zstream.next_in = &buf_in[0];
|
||||||
zstream.avail_in = len;
|
zstream.avail_in = len;
|
||||||
zstream.next_out = &buf_out[0];
|
zstream.next_out = &buf_out[0];
|
||||||
zstream.avail_out = 1024;
|
zstream.avail_out = 65536;
|
||||||
|
|
||||||
ret = inflate(&zstream, Z_SYNC_FLUSH);
|
ret = inflate(&zstream, Z_SYNC_FLUSH);
|
||||||
if (ret == Z_STREAM_END || ret == Z_BUF_ERROR)
|
if (ret != Z_STREAM_END && ret != Z_OK)
|
||||||
break;
|
|
||||||
if (ret != Z_OK)
|
|
||||||
{
|
{
|
||||||
printf("Error while decompressing: %d\n", ret);
|
printf("Error while decompressing: %d\n", ret);
|
||||||
inflateEnd(&zstream);
|
inflateEnd(&zstream);
|
||||||
@ -103,6 +101,9 @@ main(int argc, char *argv[])
|
|||||||
write(fd_out, &buf_out, zstream.total_out-last_out);
|
write(fd_out, &buf_out, zstream.total_out-last_out);
|
||||||
|
|
||||||
i += len;
|
i += len;
|
||||||
|
|
||||||
|
if (ret == Z_STREAM_END || ret == Z_BUF_ERROR)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zstream.total_out != uncomp_len-8)
|
if (zstream.total_out != uncomp_len-8)
|
||||||
|
Loading…
Reference in New Issue
Block a user