mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
util/u_vbuf: correct map offset calculation for crazy offsets
When the min_index is very large (or very negative), the multipliation can overflow 32 bits and result in an incorrect map pointer modification. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
3de97ce920
commit
45b64e52f4
1 changed files with 1 additions and 1 deletions
|
|
@ -370,7 +370,7 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
|
||||||
|
|
||||||
/* Subtract min_index so that indexing with the index buffer works. */
|
/* Subtract min_index so that indexing with the index buffer works. */
|
||||||
if (unroll_indices) {
|
if (unroll_indices) {
|
||||||
map -= vb->stride * min_index;
|
map -= (ptrdiff_t)vb->stride * min_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr->set_buffer(tr, i, map, vb->stride, ~0);
|
tr->set_buffer(tr, i, map, vb->stride, ~0);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue