[Mesa-dev] [PATCH 07/11] glapi: Add the safe_{add, mul, pad} functions from xserver

Adam Jackson ajax at redhat.com
Mon Mar 28 18:14:38 UTC 2016


On Mon, 2016-03-28 at 10:53 -0700, Ian Romanick wrote:
> On 03/24/2016 11:10 AM, Adam Jackson wrote:
> > +        print '    if (a == 0 || b == 0) return 0;'
> Is this check actually necessary?

Yes because ...

> > +        print '    if (a > INT_MAX / b) return -1;'

... you don't want to divide by zero.

- ajax


More information about the mesa-dev mailing list