[Mesa-dev] [PATCH mesa] egl/wayland: check for invalid format index

Eric Engestrom eric.engestrom at imgtec.com
Thu Feb 15 13:21:00 UTC 2018


On Thursday, 2018-02-15 11:25:33 +0000, Daniel Stone wrote:
> Hi Eric,
> 
> On 15 February 2018 at 11:17, Eric Engestrom <eric.engestrom at imgtec.com> wrote:
> > Daniel, `w` seemed like the "least bad" thing to return in this case;
> > would you prefer `0`?
> 
> I guess Coverity doesn't know it can never be invalid. We look up a
> visual in the table using dri2_surf->format, whcih is only ever set
> from the table itself when creating a surface. assert(visual_idx ==
> -1) should be enough to please Coverity there I think.

(I assume you meant `!=`)

Sounds like assume() might be better than assert() though, if it's
actually impossible (barring internal bug), so that the compiler can
drop the `== -1` paths.
Sending a v2 in a minute :)

> 
> Cheers,
> Daniel


More information about the mesa-dev mailing list