sna/video: Don't assert on a client error, return BadAlloc
If the client sends a BO that is too small to satifsy the PutImage, then reject with BadAlloc rather than die with an assert. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
cb35a0b19a
commit
7a6bd55da9
|
|
@ -523,7 +523,13 @@ sna_video_overlay_put_image(ClientPtr client,
|
|||
return BadAlloc;
|
||||
}
|
||||
|
||||
assert(kgem_bo_size(frame.bo) >= frame.size);
|
||||
if (kgem_bo_size(frame.bo) < frame.size) {
|
||||
DBG(("%s: bo size=%d, expected=%d\n",
|
||||
__FUNCTION__, kgem_bo_size(frame.bo), frame.size));
|
||||
kgem_bo_destroy(&sna->kgem, frame.bo);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
frame.image.x1 = 0;
|
||||
frame.image.y1 = 0;
|
||||
frame.image.x2 = frame.width;
|
||||
|
|
|
|||
|
|
@ -348,7 +348,13 @@ static int sna_video_sprite_put_image(ClientPtr client,
|
|||
if (frame.bo == NULL)
|
||||
return BadAlloc;
|
||||
|
||||
assert(kgem_bo_size(frame.bo) >= frame.size);
|
||||
if (kgem_bo_size(frame.bo) < frame.size) {
|
||||
DBG(("%s: bo size=%d, expected=%d\n",
|
||||
__FUNCTION__, kgem_bo_size(frame.bo), frame.size));
|
||||
kgem_bo_destroy(&sna->kgem, frame.bo);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
frame.image.x1 = 0;
|
||||
frame.image.y1 = 0;
|
||||
frame.image.x2 = frame.width;
|
||||
|
|
|
|||
|
|
@ -222,7 +222,13 @@ sna_video_textured_put_image(ClientPtr client,
|
|||
return BadAlloc;
|
||||
}
|
||||
|
||||
assert(kgem_bo_size(frame.bo) >= frame.size);
|
||||
if (kgem_bo_size(frame.bo) < frame.size) {
|
||||
DBG(("%s: bo size=%d, expected=%d\n",
|
||||
__FUNCTION__, kgem_bo_size(frame.bo), frame.size));
|
||||
kgem_bo_destroy(&sna->kgem, frame.bo);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
frame.image.x1 = 0;
|
||||
frame.image.y1 = 0;
|
||||
frame.image.x2 = frame.width;
|
||||
|
|
|
|||
Loading…
Reference in New Issue