[Mesa-dev] [PATCH 08/11] glapi: Harden GLX request size processing
Dylan Baker
baker.dylan.c at gmail.com
Fri Mar 25 23:07:31 UTC 2016
Quoting Adam Jackson (2016-03-24 11:10:03)
[snip]
> @@ -620,9 +617,10 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
> if s == 0: s = 1
>
> sig += "(%u,%u)" % (f.offset_of(p.counter), s)
> - size += '%s%s' % (plus, p.size_string())
> - plus = ' + '
> -
> + if size is '':
Use '==' not 'is' here.
Python's 'A is B' compares whether A is the exact same instance as B,
not if they have the same value, implementation details of CPython make
this work for small ints and strings/bytes/unicode...usually. Generally
save 'is' for comparisons with singletons like True, False, and None.
> + size = p.size_string()
> + else:
> + size = "safe_add(%s, %s)" % (size, p.size_string())
>
[snip]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160325/33b2d732/attachment.sig>
More information about the mesa-dev
mailing list