sna: Assert that the fill box is within bounds

References: https://bugs.freedesktop.org/show_bug.cgi?id=73811
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-01-22 16:26:14 +00:00
parent 29e11e2e6f
commit 32010ed86b
1 changed files with 13 additions and 3 deletions

View File

@ -944,6 +944,11 @@ blt_composite_fill_box__cpu(struct sna *sna,
const struct sna_composite_op *op,
const BoxRec *box)
{
assert(box->x1 >= 0);
assert(box->y1 >= 0);
assert(box->x2 <= op->dst.pixmap->drawable.width);
assert(box->y2 <= op->dst.pixmap->drawable.height);
pixman_fill(op->dst.pixmap->devPrivate.ptr,
op->dst.pixmap->devKind / sizeof(uint32_t),
op->dst.pixmap->drawable.bitsPerPixel,
@ -957,6 +962,11 @@ blt_composite_fill_boxes__cpu(struct sna *sna,
const BoxRec *box, int n)
{
do {
assert(box->x1 >= 0);
assert(box->y1 >= 0);
assert(box->x2 <= op->dst.pixmap->drawable.width);
assert(box->y2 <= op->dst.pixmap->drawable.height);
pixman_fill(op->dst.pixmap->devPrivate.ptr,
op->dst.pixmap->devKind / sizeof(uint32_t),
op->dst.pixmap->drawable.bitsPerPixel,
@ -1327,9 +1337,9 @@ prepare_blt_clear(struct sna *sna,
op->done = nop_done;
if (!sna_blt_fill_init(sna, &op->u.blt,
op->dst.bo,
op->dst.pixmap->drawable.bitsPerPixel,
GXclear, 0))
op->dst.bo,
op->dst.pixmap->drawable.bitsPerPixel,
GXclear, 0))
return false;
return begin_blt(sna, op);