aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_state_common.c
diff options
context:
space:
mode:
authorDenis Pauk <[email protected]>2017-09-12 23:38:45 +0300
committerMarek Olšák <[email protected]>2017-09-14 00:59:24 +0200
commit74d2456491fbd96eb3fb99cf8dd3595b223c2065 (patch)
tree433aa22af9f3f372987d703e89ac5d193d445597 /src/gallium/drivers/r600/r600_state_common.c
parentedfd8d42a9ac870a6ebc5a56fc003f60f86b702c (diff)
gallium/{r600, radeonsi}: Fix segfault with color format (v2)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102552 v2: Patch cleanup proposed by Nicolai Hähnle. * deleted changes in si_translate_texformat. Cc: Nicolai Hähnle <[email protected]> Cc: Ilia Mirkin <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_state_common.c')
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index c1bce8304b2..1515c28091c 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -2284,6 +2284,8 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen,
format = PIPE_FORMAT_A4R4_UNORM;
desc = util_format_description(format);
+ if (!desc)
+ goto out_unknown;
/* Depth and stencil swizzling is handled separately. */
if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) {
@@ -2650,6 +2652,8 @@ uint32_t r600_translate_colorformat(enum chip_class chip, enum pipe_format forma
const struct util_format_description *desc = util_format_description(format);
int channel = util_format_get_first_non_void_channel(format);
bool is_float;
+ if (!desc)
+ return ~0U;
#define HAS_SIZE(x,y,z,w) \
(desc->channel[0].size == (x) && desc->channel[1].size == (y) && \