Browse Source

avcodec/encode: Fix check for allowed LJPEG pixel formats

The pix_fmts of the LJPEG encoder already contain all supported pixel
formats (including the ones only supported when strictness is unofficial
or less); yet the check in ff_encode_preinit() ignored this list in case
strictness is unofficial or less. But the encoder presumed that it is
always applied and blacklists some of the entries in pix_fmts when
strictness is > unofficial. The result is that if one uses an entry not
on that list and sets strictness to unofficial, said entry passes both
checks and this can lead to segfaults lateron (e.g. when using gray).

Fix this by removing the exception for LJPEG in ff_encode_preinit().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 6e8e9b7633)
tags/n4.4
Andreas Rheinhardt 4 years ago
parent
commit
fb7cd45977
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavcodec/encode.c

+ 1
- 1
libavcodec/encode.c View File

@@ -565,7 +565,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
break;
if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE
&& !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG)
&& !(avctx->codec_id == AV_CODEC_ID_MJPEG
&& avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) {
char buf[128];
snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt);


Loading…
Cancel
Save