History

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.

Andreas Rheinhardt committed 5 years ago

Commit 48285091 parent 2b0f2951 file · +1 −2Browse files

Showing the changes to libavcodec/avcodec.c (1 of 1 file). Show all

Unified · Split

libavcodec/avcodec.c+1−2
@@ -364,9 +364,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code · 363 unmodified lines
364 avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));364 avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
365#endif365#endif
366 }366 }
367 if (codec->priv_data_size > 0 && avctx->priv_data && codec->priv_class) {367 if (codec->priv_class)
368 av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);368 av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);
369 }
370 369
371end:370end:
372 unlock_avcodec(codec);371 unlock_avcodec(codec);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t