[FFmpeg-devel] [PATCH v2 2/2] lavf/dump: add the valid check for consistent

James Almer jamrial at gmail.com
Sat Aug 17 20:50:24 EEST 2019


On 8/10/2019 12:53 PM, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
>  libavformat/dump.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/libavformat/dump.c b/libavformat/dump.c
> index 68ce9a8..4b18032 100644
> --- a/libavformat/dump.c
> +++ b/libavformat/dump.c
> @@ -328,6 +328,11 @@ static void dump_cpb(void *ctx, AVPacketSideData *sd)
>  
>  static void dump_mastering_display_metadata(void *ctx, AVPacketSideData* sd) {
>      AVMasteringDisplayMetadata* metadata = (AVMasteringDisplayMetadata*)sd->data;
> +
> +    if (sd->size < sizeof(*metadata)) {
> +        av_log(ctx, AV_LOG_ERROR, "invalid data");
> +        return;
> +    }
>      av_log(ctx, AV_LOG_INFO, "Mastering Display Metadata, "
>             "has_primaries:%d has_luminance:%d "
>             "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
> @@ -346,6 +351,11 @@ static void dump_mastering_display_metadata(void *ctx, AVPacketSideData* sd) {
>  static void dump_content_light_metadata(void *ctx, AVPacketSideData* sd)
>  {
>      AVContentLightMetadata* metadata = (AVContentLightMetadata*)sd->data;
> +
> +    if (sd->size < sizeof(*metadata)) {
> +        av_log(ctx, AV_LOG_ERROR, "invalid data");
> +        return;
> +    }
>      av_log(ctx, AV_LOG_INFO, "Content Light Level Metadata, "
>             "MaxCLL=%d, MaxFALL=%d",
>             metadata->MaxCLL, metadata->MaxFALL);

No, the size of both structs is not part of the ABI.


More information about the ffmpeg-devel mailing list