script-surface: Check for invalid ids (CID #1159557, 1159558)
commit9d2e3646fa04c98747ae3b05a9be433eda7f2730
authorBryce Harrington <bryce@bryceharrington.org>
Wed, 6 Jun 2018 16:30:00 +0000 (6 09:30 -0700)
committerBryce Harrington <bryce@bryceharrington.org>
Wed, 13 Jun 2018 22:21:50 +0000 (13 15:21 -0700)
tree8e04745c1ca9a82a967e7eeb41efdfd7981537f8
parentd09d2ebfd5845de7b3fa12b76c4abead4d587016
script-surface: Check for invalid ids (CID #11595571159558)

If the bitmap's min is non-zero, _bitmap_next_id() could break out of
its loop early, before initializing the prev variable.  prev would then
be dereferenced without a null ptr check.  This condition should never
occur in practice, so add an assert() to assure it doesn't.

Same issue is present in trace.c.

Coverity IDs: #1159557, #1159558
Reviewed-By: Uli Schlachter <psychon@znc.in>
Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
src/cairo-script-surface.c
util/cairo-trace/trace.c