diff mbox series

[FFmpeg-devel,07/11] avcodec/avcodec: Make sanity check stricter

Message ID PR3PR03MB6665DBAC1767D241042DEA0C8FA49@PR3PR03MB6665.eurprd03.prod.outlook.com
State Accepted
Commit 482850992cb12a65b6754d8dee6544e7b4d2f80d
Headers show
Series [FFmpeg-devel,01/11] avcodec/tests/utils: Rename to avcodec
Related show


Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 24, 2021, 4:37 p.m. UTC
If an AVCodec has a private class, its priv_data_size must be > 0
and at the end of a successful call to avcodec_open2()
the AVCodecContext's priv_data must exist and its first element must
be a pointer to said AVClass. This should not be conditioned
on priv_data_size being > 0 (which is tested by FATE) or
on the private context having been successfully allocated
(which has to have happened at that point). So remove these
preconditions to make the test stricter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
 libavcodec/avcodec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series


diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 2dd7dd84e0..97eb1ec431 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -364,9 +364,8 @@  int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
             avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
-    if (codec->priv_data_size > 0 && avctx->priv_data && codec->priv_class) {
+    if (codec->priv_class)
         av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);
-    }