Skip to content
Snippets Groups Projects
Commit c69defd4 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

avcodec/qtrleenc: Check that width is a multiple of 4 for grayscale


grayscale is coded as 4 pixels at a time, the encoder lacks support
for the case where width%4 != 0, and will simply encode less data
leaving random data after decoding at the right side

Signed-off-by: default avatarMichael Niedermayer <michaelni@gmx.at>
parent 43d995e8
No related branches found
No related tags found
No related merge requests found
...@@ -86,6 +86,10 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx) ...@@ -86,6 +86,10 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx)
switch (avctx->pix_fmt) { switch (avctx->pix_fmt) {
case AV_PIX_FMT_GRAY8: case AV_PIX_FMT_GRAY8:
if (avctx->width % 4) {
av_log(avctx, AV_LOG_ERROR, "Width not being a multiple of 4 is not supported\n");
return AVERROR(EINVAL);
}
s->logical_width = avctx->width / 4; s->logical_width = avctx->width / 4;
s->pixel_size = 4; s->pixel_size = 4;
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment