[Mesa-dev] [PATCH] i965: Fix bugs in intel_from_planar

Daniel Stone daniel at fooishbar.org
Mon Feb 12 09:59:39 UTC 2018


Hi Jason,

On 10 February 2018 at 06:50, Jason Ekstrand <jason at jlekstrand.net> wrote:
>  intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
>  {
>      int width, height, offset, stride, dri_format, index;
> -    const struct intel_image_format *f;
>      __DRIimage *image;
>
> -    if (parent == NULL) {
> +    if (parent == NULL)
>         return NULL;
> -    } else if (parent->planar_format == NULL) {
> +
> +    const struct intel_image_format *f = parent->planar_format;
> +    const int nplanes = f ? f->nplanes : 1;
> +
> +    if (plane > nplanes) {

This should be >= ...

> +       if (parent->modifier == DRM_FORMAT_MOD_INVALID)
> +          return NULL;
> +
>         const bool is_aux =
>            isl_drm_modifier_has_aux(parent->modifier) && plane == 1;

Or this will never be true.

Cheers,
Daniel


More information about the mesa-dev mailing list