zink: avoid overflow when clamping bufferviews

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18784>
This commit is contained in:
Mike Blumenkrantz
2022-09-07 13:21:28 -04:00
committed by Marge Bot
parent 55d6847d22
commit 084f3b6664
+1 -1
View File
@@ -815,7 +815,7 @@ create_bvci(struct zink_context *ctx, struct zink_resource *res, enum pipe_forma
if (bvci.offset + bvci.range >= res->base.b.width0)
bvci.range = VK_WHOLE_SIZE;
}
uint32_t clamp = blocksize * screen->info.props.limits.maxTexelBufferElements;
uint64_t clamp = blocksize * screen->info.props.limits.maxTexelBufferElements;
if (bvci.range == VK_WHOLE_SIZE && res->base.b.width0 > clamp)
bvci.range = clamp;
bvci.flags = 0;