diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2012-03-18 09:11:39 +0100 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2012-03-19 09:21:05 +0100 |
commit | bb39bd195a7dec3e8c7eb9ae4294f2fd0f548ed9 (patch) | |
tree | c3956b870742d74e028704416fd385136e8f9a9a | |
parent | afc2263bccbffb94c645ca5fcbc7b74b78be5468 (diff) | |
download | ffmpeg-bb39bd195a7dec3e8c7eb9ae4294f2fd0f548ed9.tar.gz |
zmbv: check decompress result
Changing flush type from Z_FINISH is needed since encoder compresses fixed
amount of data and doesn't care about writing end of stream marker.
-rw-r--r-- | libavcodec/zmbv.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index 62045c087a..49e15ff7f9 100644 --- a/libavcodec/zmbv.c +++ b/libavcodec/zmbv.c @@ -512,7 +512,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac c->zstream.avail_in = len; c->zstream.next_out = c->decomp_buf; c->zstream.avail_out = c->decomp_size; - inflate(&c->zstream, Z_FINISH); + zret = inflate(&c->zstream, Z_SYNC_FLUSH); + if (zret != Z_OK && zret != Z_STREAM_END) { + av_log(avctx, AV_LOG_ERROR, "inflate error %d\n", zret); + return AVERROR_INVALIDDATA; + } c->decomp_len = c->zstream.total_out; } if (c->flags & ZMBV_KEYFRAME) { |