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
|
@ -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. */
|
||||
if (unroll_indices) {
|
||||
map -= vb->stride * min_index;
|
||||
map -= (ptrdiff_t)vb->stride * min_index;
|
||||
}
|
||||
|
||||
tr->set_buffer(tr, i, map, vb->stride, ~0);
|
||||
|
|
Loading…
Reference in New Issue