summaryrefslogtreecommitdiff
path: root/libavcodec/avcodec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-24 04:42:50 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-26 13:29:19 +0200
commit482850992cb12a65b6754d8dee6544e7b4d2f80d (patch)
tree7de79a4afbd1aff15c162eb29fe87c0ceecb7234 /libavcodec/avcodec.c
parent2b0f29507f40db38e88ec157dcb3acaf43abce65 (diff)
downloadffmpeg-482850992cb12a65b6754d8dee6544e7b4d2f80d.tar.gz
avcodec/avcodec: Make sanity check stricter
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 conditional 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>
Diffstat (limited to 'libavcodec/avcodec.c')
-rw-r--r--libavcodec/avcodec.c3
1 files changed, 1 insertions, 2 deletions
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}));
#endif
}
- 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);
- }
end:
unlock_avcodec(codec);