[FFmpeg-cvslog] avcodec/pixlet: make sure scaling factors are not zero
Paul B Mahol
git at videolan.org
Sat Dec 24 11:41:33 EET 2016
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Dec 24 10:31:43 2016 +0100| [6cedd20b97292acdbfc5a30decbaa9bd62f287f8] | committer: Paul B Mahol
avcodec/pixlet: make sure scaling factors are not zero
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6cedd20b97292acdbfc5a30decbaa9bd62f287f8
---
libavcodec/pixlet.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index e78b666..0f13b5b 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -504,8 +504,14 @@ static int decode_plane(AVCodecContext *avctx, int plane, AVPacket *avpkt, AVFra
int i, ret;
for (i = ctx->levels - 1; i >= 0; i--) {
- ctx->scaling[plane][H][i] = 1000000.0f / sign_extend(bytestream2_get_be32(&ctx->gb), 32);
- ctx->scaling[plane][V][i] = 1000000.0f / sign_extend(bytestream2_get_be32(&ctx->gb), 32);
+ int32_t h = sign_extend(bytestream2_get_be32(&ctx->gb), 32);
+ int32_t v = sign_extend(bytestream2_get_be32(&ctx->gb), 32);
+
+ if (!h || !v)
+ return AVERROR_INVALIDDATA;
+
+ ctx->scaling[plane][H][i] = 1000000.0f / h;
+ ctx->scaling[plane][V][i] = 1000000.0f / v;
}
bytestream2_skip(&ctx->gb, 4);
More information about the ffmpeg-cvslog
mailing list