summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2017-07-13 16:11:40 +0100
committerLionel Landwerlin <[email protected]>2017-07-13 22:50:35 +0100
commitfd8e8fdbfeb9594946727909a4fb3956733fc3db (patch)
tree09aa0552d5388fb248f0c9fc29c33d07f3dd32f2 /src
parentb02d136b5e14f94e5f3ab8489f0fbfaa88e76820 (diff)
i965: check pointer before dereferencing it
Check that irb isn't NULL before accessing irb->Base.Base.NumSamples. CID: 1026046 Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_copy.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_tex_copy.c b/src/mesa/drivers/dri/i965/intel_tex_copy.c
index e0d5cadb6f6..4fe3585296d 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_copy.c
@@ -52,6 +52,13 @@ intel_copy_texsubimage(struct brw_context *brw,
{
const GLenum internalFormat = intelImage->base.Base.InternalFormat;
+ if (!intelImage->mt || !irb || !irb->mt) {
+ if (unlikely(INTEL_DEBUG & DEBUG_PERF))
+ fprintf(stderr, "%s fail %p %p (0x%08x)\n",
+ __func__, intelImage->mt, irb, internalFormat);
+ return false;
+ }
+
/* No pixel transfer operations (zoom, bias, mapping), just a blit */
if (brw->ctx._ImageTransferState)
return false;
@@ -69,13 +76,6 @@ intel_copy_texsubimage(struct brw_context *brw,
/* glCopyTexSubImage() can't be called on a multisampled texture. */
assert(intelImage->base.Base.NumSamples == 0);
- if (!intelImage->mt || !irb || !irb->mt) {
- if (unlikely(INTEL_DEBUG & DEBUG_PERF))
- fprintf(stderr, "%s fail %p %p (0x%08x)\n",
- __func__, intelImage->mt, irb, internalFormat);
- return false;
- }
-
/* account for view parameters and face index */
int dst_level = intelImage->base.Base.Level +
intelImage->base.Base.TexObject->MinLevel;