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_fbo.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_fbo.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_fbo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index d56fc5b..37ac613f 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -127,7 +127,7 @@ intel_map_renderbuffer(struct gl_context *ctx, struct intel_renderbuffer *irb = intel_renderbuffer(rb); struct intel_mipmap_tree *mt; void *map; - int stride; + ptrdiff_t stride; if (srb->Buffer) { /* this is a malloc'd renderbuffer (accum buffer), not an irb */ @@ -189,7 +189,7 @@ intel_map_renderbuffer(struct gl_context *ctx, stride = -stride; } - DBG("%s: rb %d (%s) mt mapped: (%d, %d) (%dx%d) -> %p/%d\n", + DBG("%s: rb %d (%s) mt mapped: (%d, %d) (%dx%d) -> %p/%"PRIdPTR"\n", __FUNCTION__, rb->Name, _mesa_get_format_name(rb->Format), x, y, w, h, map, stride); |