diff options
author | Chad Versace <chad.versace@linux.intel.com> | 2014-11-18 21:11:24 -0800 |
---|---|---|
committer | Chad Versace <chad.versace@intel.com> | 2014-12-22 15:47:07 -0600 |
commit | aebcf26d8219cee79da89313124c2147595a660c (patch) | |
tree | ed9e9d9b4bdad23ce032738501282f3ee8bae463 /src/mesa/drivers/dri/i965/intel_copy_image.c | |
parent | d11bc9fe8daf097741713cde6bdd79e1f0e0e8fc (diff) | |
download | external_mesa3d-aebcf26d8219cee79da89313124c2147595a660c.zip external_mesa3d-aebcf26d8219cee79da89313124c2147595a660c.tar.gz external_mesa3d-aebcf26d8219cee79da89313124c2147595a660c.tar.bz2 |
i965: Fix intel_miptree_map() signature to be more 64-bit safe
This patch should diminish the likelihood of pointer arithmetic overflow
bugs, like the one fixed by b69c7c5dac.
Change the type of parameter 'out_stride' from int to ptrdiff_t. The
logic is that if you call intel_miptree_map() and use the value of
'out_stride', then you must be doing pointer arithmetic on 'out_ptr'.
Using ptrdiff_t instead of int should make a little bit harder to hit
overflow bugs.
As a side-effect, some function-scope variables needed to be retyped to
avoid compilation errors.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_copy_image.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_copy_image.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_copy_image.c b/src/mesa/drivers/dri/i965/intel_copy_image.c index cb44474..f4c7eff 100644 --- a/src/mesa/drivers/dri/i965/intel_copy_image.c +++ b/src/mesa/drivers/dri/i965/intel_copy_image.c @@ -145,7 +145,7 @@ copy_image_with_memcpy(struct brw_context *brw, { bool same_slice; void *mapped, *src_mapped, *dst_mapped; - int src_stride, dst_stride, i, cpp; + ptrdiff_t src_stride, dst_stride, cpp; int map_x1, map_y1, map_x2, map_y2; GLuint src_bw, src_bh; @@ -197,7 +197,7 @@ copy_image_with_memcpy(struct brw_context *brw, src_width /= (int)src_bw; src_height /= (int)src_bh; - for (i = 0; i < src_height; ++i) { + for (int i = 0; i < src_height; ++i) { memcpy(dst_mapped, src_mapped, src_width * cpp); src_mapped += src_stride; dst_mapped += dst_stride; |