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: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-06-11 04:02:53 +02:00
parent 43d995e865
commit c69defd4d0
1 changed files with 4 additions and 0 deletions

View File

@ -86,6 +86,10 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx)
switch (avctx->pix_fmt) {
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->pixel_size = 4;
break;