summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadym Shovkoplias <vadym.shovkoplias@globallogic.com>2017-11-27 12:15:13 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2017-12-01 17:13:02 +0000
commit4e84aaa906e7abf41b170146dd7ef3e7a76820b9 (patch)
tree529c3a26a23b8e81c23464c65b84727239bcc170
parentbcd4f26b41c97991d1268c308c15c350bd1da318 (diff)
intel/blorp: Fix possible NULL pointer dereferencing
Fix incomplete check of input params in blorp_surf_convert_to_uncompressed() which can lead to NULL pointer dereferencing. Fixes: 5ae8043fed2 ("intel/blorp: Add an entrypoint for doing bit-for-bit copies") Fixes: f395d0abc83 ("intel/blorp: Internally expose surf_convert_to_uncompressed") Reviewed-by: Emil Velikov <emli.velikov@collabora.com> Reviewed-by: Andres Gomez <agomez@igalia.com> (cherry picked from commit cdb3eb7174f84f3200408c4b43c819fb093da9c6)
-rw-r--r--src/intel/blorp/blorp_blit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 4507046dae5..7ab08192cab 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -2344,7 +2344,7 @@ blorp_surf_convert_to_uncompressed(const struct isl_device *isl_dev,
*/
blorp_surf_convert_to_single_slice(isl_dev, info);
- if (width || height) {
+ if (width && height) {
#ifndef NDEBUG
uint32_t right_edge_px = info->tile_x_sa + *x + *width;
uint32_t bottom_edge_px = info->tile_y_sa + *y + *height;
@@ -2357,7 +2357,7 @@ blorp_surf_convert_to_uncompressed(const struct isl_device *isl_dev,
*height = DIV_ROUND_UP(*height, fmtl->bh);
}
- if (x || y) {
+ if (x && y) {
assert(*x % fmtl->bw == 0);
assert(*y % fmtl->bh == 0);
*x /= fmtl->bw;