[FFmpeg-cvslog] webp: ensure that each transform is only used once
ffmpeg | branch: release/2.4 | Andreas Cadhalpun | Thu Mar 5 22:48:28 2015 +0100| [53fa0d370cbbf7605687a2d3c669f7f015136931] | committer: Michael Niedermayer webp: ensure that each transform is only used once According to the WebP Lossless Bitstream Specification "each transform is allowed to be used only once". If a transform is more than once this can lead to memory corruption. Signed-off-by: Michael Niedermayer (cherry picked from commit c089e720c1b753790c746a13053636d7facf6bf0) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=53fa0d370cbbf7605687a2d3c669f7f015136931 --- libavcodec/webp.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 31c5bd9..c92539f 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -1087,7 +1087,7 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, unsigned int data_size, int is_alpha_chunk) { WebPContext *s = avctx->priv_data; -int w, h, ret, i; +int w, h, ret, i, used; if (!is_alpha_chunk) { s->lossless = 1; @@ -1137,8 +1137,16 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, /* parse transformations */ s->nb_transforms = 0; s->reduced_width = 0; +used = 0; while (get_bits1(&s->gb)) { enum TransformType transform = get_bits(&s->gb, 2); +if (used & (1 << transform)) { +av_log(avctx, AV_LOG_ERROR, "Transform %d used more than once\n", + transform); +ret = AVERROR_INVALIDDATA; +goto free_and_return; +} +used |= (1 << transform); s->transforms[s->nb_transforms++] = transform; switch (transform) { case PREDICTOR_TRANSFORM: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] webp: ensure that each transform is only used once
ffmpeg | branch: release/2.4 | Andreas Cadhalpun | Thu Mar 5 22:48:28 2015 +0100| [b7c8a1fbbd0b6ac0b096ef0402dee440ff27ecb7] | committer: Anton Khirnov webp: ensure that each transform is only used once According to the WebP Lossless Bitstream Specification "each transform is allowed to be used only once". If a transform is more than once this can lead to memory corruption. Signed-off-by: Andreas Cadhalpun Signed-off-by: Anton Khirnov (cherry picked from commit 30e6abd1a8cc4fd5daf2e23ad2e768862c39e975) Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b7c8a1fbbd0b6ac0b096ef0402dee440ff27ecb7 --- libavcodec/webp.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 58f7810..62f35f7 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -1081,7 +1081,7 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, unsigned int data_size, int is_alpha_chunk) { WebPContext *s = avctx->priv_data; -int w, h, ret, i; +int w, h, ret, i, used; if (!is_alpha_chunk) { s->lossless = 1; @@ -1131,9 +1131,17 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, /* parse transformations */ s->nb_transforms = 0; s->reduced_width = 0; +used = 0; while (get_bits1(&s->gb)) { enum TransformType transform = get_bits(&s->gb, 2); s->transforms[s->nb_transforms++] = transform; +if (used & (1 << transform)) { +av_log(avctx, AV_LOG_ERROR, "Transform %d used more than once\n", + transform); +ret = AVERROR_INVALIDDATA; +goto free_and_return; +} +used |= (1 << transform); switch (transform) { case PREDICTOR_TRANSFORM: ret = parse_transform_predictor(s); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] webp: ensure that each transform is only used once
ffmpeg | branch: release/2.5 | Andreas Cadhalpun | Thu Mar 5 22:48:28 2015 +0100| [57c7922331d5f2c0999046845bd9bf24ac74c2b7] | committer: Michael Niedermayer webp: ensure that each transform is only used once According to the WebP Lossless Bitstream Specification "each transform is allowed to be used only once". If a transform is more than once this can lead to memory corruption. Signed-off-by: Michael Niedermayer (cherry picked from commit c089e720c1b753790c746a13053636d7facf6bf0) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57c7922331d5f2c0999046845bd9bf24ac74c2b7 --- libavcodec/webp.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 4b1c8e7..802b03c 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -1099,7 +1099,7 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, unsigned int data_size, int is_alpha_chunk) { WebPContext *s = avctx->priv_data; -int w, h, ret, i; +int w, h, ret, i, used; if (!is_alpha_chunk) { s->lossless = 1; @@ -1149,8 +1149,16 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, /* parse transformations */ s->nb_transforms = 0; s->reduced_width = 0; +used = 0; while (get_bits1(&s->gb)) { enum TransformType transform = get_bits(&s->gb, 2); +if (used & (1 << transform)) { +av_log(avctx, AV_LOG_ERROR, "Transform %d used more than once\n", + transform); +ret = AVERROR_INVALIDDATA; +goto free_and_return; +} +used |= (1 << transform); s->transforms[s->nb_transforms++] = transform; switch (transform) { case PREDICTOR_TRANSFORM: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] webp: ensure that each transform is only used once
ffmpeg | branch: master | Andreas Cadhalpun | Thu Mar 5 22:48:28 2015 +0100| [30e6abd1a8cc4fd5daf2e23ad2e768862c39e975] | committer: Anton Khirnov webp: ensure that each transform is only used once According to the WebP Lossless Bitstream Specification "each transform is allowed to be used only once". If a transform is more than once this can lead to memory corruption. Signed-off-by: Andreas Cadhalpun Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30e6abd1a8cc4fd5daf2e23ad2e768862c39e975 --- libavcodec/webp.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 58f7810..62f35f7 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -1081,7 +1081,7 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, unsigned int data_size, int is_alpha_chunk) { WebPContext *s = avctx->priv_data; -int w, h, ret, i; +int w, h, ret, i, used; if (!is_alpha_chunk) { s->lossless = 1; @@ -1131,9 +1131,17 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, /* parse transformations */ s->nb_transforms = 0; s->reduced_width = 0; +used = 0; while (get_bits1(&s->gb)) { enum TransformType transform = get_bits(&s->gb, 2); s->transforms[s->nb_transforms++] = transform; +if (used & (1 << transform)) { +av_log(avctx, AV_LOG_ERROR, "Transform %d used more than once\n", + transform); +ret = AVERROR_INVALIDDATA; +goto free_and_return; +} +used |= (1 << transform); switch (transform) { case PREDICTOR_TRANSFORM: ret = parse_transform_predictor(s); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] webp: ensure that each transform is only used once
ffmpeg | branch: release/2.2 | Andreas Cadhalpun | Thu Mar 5 22:48:28 2015 +0100| [c0dc649e81bf65e8bb6b773cefc243ef53d02924] | committer: Michael Niedermayer webp: ensure that each transform is only used once According to the WebP Lossless Bitstream Specification "each transform is allowed to be used only once". If a transform is more than once this can lead to memory corruption. Signed-off-by: Michael Niedermayer (cherry picked from commit c089e720c1b753790c746a13053636d7facf6bf0) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c0dc649e81bf65e8bb6b773cefc243ef53d02924 --- libavcodec/webp.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index f14213f..0355cb6 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -1078,7 +1078,7 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, unsigned int data_size, int is_alpha_chunk) { WebPContext *s = avctx->priv_data; -int w, h, ret, i; +int w, h, ret, i, used; if (!is_alpha_chunk) { s->lossless = 1; @@ -1128,8 +1128,16 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, /* parse transformations */ s->nb_transforms = 0; s->reduced_width = 0; +used = 0; while (get_bits1(&s->gb)) { enum TransformType transform = get_bits(&s->gb, 2); +if (used & (1 << transform)) { +av_log(avctx, AV_LOG_ERROR, "Transform %d used more than once\n", + transform); +ret = AVERROR_INVALIDDATA; +goto free_and_return; +} +used |= (1 << transform); s->transforms[s->nb_transforms++] = transform; switch (transform) { case PREDICTOR_TRANSFORM: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] webp: ensure that each transform is only used once
ffmpeg | branch: master | Andreas Cadhalpun | Thu Mar 5 22:48:28 2015 +0100| [c089e720c1b753790c746a13053636d7facf6bf0] | committer: Michael Niedermayer webp: ensure that each transform is only used once According to the WebP Lossless Bitstream Specification "each transform is allowed to be used only once". If a transform is more than once this can lead to memory corruption. Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c089e720c1b753790c746a13053636d7facf6bf0 --- libavcodec/webp.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 9549c0e..47e9e9e 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -1104,7 +1104,7 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, unsigned int data_size, int is_alpha_chunk) { WebPContext *s = avctx->priv_data; -int w, h, ret, i; +int w, h, ret, i, used; if (!is_alpha_chunk) { s->lossless = 1; @@ -1154,8 +1154,16 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, /* parse transformations */ s->nb_transforms = 0; s->reduced_width = 0; +used = 0; while (get_bits1(&s->gb)) { enum TransformType transform = get_bits(&s->gb, 2); +if (used & (1 << transform)) { +av_log(avctx, AV_LOG_ERROR, "Transform %d used more than once\n", + transform); +ret = AVERROR_INVALIDDATA; +goto free_and_return; +} +used |= (1 << transform); s->transforms[s->nb_transforms++] = transform; switch (transform) { case PREDICTOR_TRANSFORM: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog