| 38 | #define ERR_EXT(msg, ...) ERR_INTERNAL(msg, , __VA_ARGS__) |
| 39 | |
| 40 | static int priv_data_size_wrong(const FFCodec *codec) |
| 41 | { |
| 42 | if (codec->priv_data_size < 0 || |
| 43 | codec->p.priv_class && codec->priv_data_size < sizeof(AVClass*)) |
| 44 | return 1; |
| 45 | if (!codec->p.priv_class || !codec->p.priv_class->option) |
| 46 | return 0; |
| 47 | for (const AVOption *opt = codec->p.priv_class->option; opt->name; opt++) { |
| 48 | if (opt->offset >= codec->priv_data_size || |
| 49 | opt->type == AV_OPT_TYPE_CONST && opt->offset != 0 || |
| 50 | opt->type != AV_OPT_TYPE_CONST && (opt->offset < sizeof(AVClass*) || opt->offset < 0)) { |
| 51 | AV_LOG("Option %s offset %d nonsensical\n", |
| 52 | opt->name, opt->offset); |
| 53 | return 1; |
| 54 | } |
| 55 | } |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | #define ARRAY_CHECK(field, var, type, is_sentinel, check, sentinel_check) \ |
| 60 | do { \ |