gallium/util: Make u_prims_for_vertices() safe
authorEdward O'Callaghan <eocallaghan@alterapraxis.com>
Wed, 9 Dec 2015 09:07:57 +0000 (20:07 +1100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 9 Dec 2015 21:51:56 +0000 (22:51 +0100)
commitf32f80e19d2f772b29ab3f3346ca524be356989e
tree6df7050279f80eeea9c2f9d964d42d434a5e659e
parent63fe600c7a3f0f7070827dc0c9fb37d5e908cb59
gallium/util: Make u_prims_for_vertices() safe

Let us avoid trapping in hardware from a SIGFPE and instead
assert on a zero divisor.

Hint: This can occur if a PIPE_PRIM_? is not handled in
      u_prim_vertex_count() that results in ' info ' not
      being initialized in the expected manner.

Further, we also fix a possibly NULL pointer dereference
from ' info ' being NULL from a u_prim_vertex_count() call.

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/util/u_prim.h