radv: add an assertion in radv_gfx10_compute_bin_size()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 21 Oct 2019 08:40:23 +0000 (10:40 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 23 Oct 2019 06:33:12 +0000 (08:33 +0200)
To prevent out of bounds access.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_pipeline.c

index f8dd6178733c457bdef21fc5ece86bb047bc6c28..9c83e22fda2c197bda5f2df7b43f0898614cccf8 100644 (file)
@@ -3226,6 +3226,7 @@ radv_gfx10_compute_bin_size(struct radv_pipeline *pipeline, const VkGraphicsPipe
                        color_bytes_per_pixel += vk_format_get_blocksize(format);
 
                        if (total_samples > 1) {
+                               assert(samples_log <= 3);
                                const unsigned fmask_array[] = {0, 1, 1, 4};
                                fmask_bytes_per_pixel += fmask_array[samples_log];
                        }