Skip to content
Snippets Groups Projects
Commit 8b6aa864 authored by Anuj Phogat's avatar Anuj Phogat Committed by Chad Versace
Browse files

intel: Add a null pointer check before dereferencing the pointer


Reviewed-by: default avatarJordan Justen <jordan.l.justen@intel.com>
Reviewed-by: default avatarMatt Turner <mattst88@gmail.com>
(cherry picked from commit 484b89ac)
parent bd5ccbd4
No related branches found
No related tags found
Loading
......@@ -306,6 +306,9 @@ intel_create_image_from_name(__DRIscreen *screen,
int cpp;
image = intel_allocate_image(format, loaderPrivate);
if (image == NULL)
return NULL;
if (image->format == MESA_FORMAT_NONE)
cpp = 1;
else
......@@ -399,6 +402,9 @@ intel_create_image(__DRIscreen *screen,
}
image = intel_allocate_image(format, loaderPrivate);
if (image == NULL)
return NULL;
cpp = _mesa_get_format_bytes(image->format);
image->region =
intel_region_alloc(intelScreen, tiling, cpp, width, height, true);
......@@ -545,6 +551,9 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
stride = parent->strides[index];
image = intel_allocate_image(dri_format, loaderPrivate);
if (image == NULL)
return NULL;
if (offset + height * stride > parent->region->bo->size) {
_mesa_warning(NULL, "intel_create_sub_image: subimage out of bounds");
free(image);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment