summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2018-10-07 17:43:57 -0400
committerIlia Mirkin <[email protected]>2018-10-09 10:33:11 -0400
commit9bf0614116cdfdbfca9952c6547331731a462dcc (patch)
tree5aef3414808f25bb4d1b7aa525b547aebf2a4516 /src/gallium/drivers
parent78d3640e49918cbd7a9fd4d0220e47c81902f455 (diff)
nv50,nvc0: guard against zero-size blits
The current state tracker can generate these sometimes. Fixing this is more involved, and due to some integer math we can generate divisions-by-zero. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Karol Herbst <[email protected]> Cc: [email protected]
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_surface.c7
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_surface.c7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
index 1ef0f5030a5..de840eb531b 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
@@ -1669,6 +1669,13 @@ nv50_blit(struct pipe_context *pipe, const struct pipe_blit_info *info)
struct nouveau_pushbuf *push = nv50->base.pushbuf;
bool eng3d = FALSE;
+ if (info->src.box.width == 0 || info->src.box.height == 0 ||
+ info->dst.box.width == 0 || info->dst.box.height == 0) {
+ pipe_debug_message(&nv50->base.debug, ERROR,
+ "Blit with zero-size src or dst box");
+ return;
+ }
+
if (util_format_is_depth_or_stencil(info->dst.resource->format)) {
if (!(info->mask & PIPE_MASK_ZS))
return;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
index 39b1369758a..120f9fe6ab9 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
@@ -1573,6 +1573,13 @@ nvc0_blit(struct pipe_context *pipe, const struct pipe_blit_info *info)
struct nouveau_pushbuf *push = nvc0->base.pushbuf;
bool eng3d = false;
+ if (info->src.box.width == 0 || info->src.box.height == 0 ||
+ info->dst.box.width == 0 || info->dst.box.height == 0) {
+ pipe_debug_message(&nvc0->base.debug, ERROR,
+ "Blit with zero-size src or dst box");
+ return;
+ }
+
if (util_format_is_depth_or_stencil(info->dst.resource->format)) {
if (!(info->mask & PIPE_MASK_ZS))
return;