diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-28 11:35:48 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-28 11:40:19 +0300 |
commit | f09480b2125c6125212fb3f057ebb4a9061bc134 (patch) | |
tree | f873d06946bbaa259130b2bff8722d2535cc9e2a /source/blender/draw | |
parent | 3f2bde5a398657b3a9965447ab34c4132acc8556 (diff) |
Hair drawing: respect the amount of layers.
Current implementation works with at most of 3 layers, but was not
checked during hair drawing leading to reading from uninitialized
memory.
This commit limits it to the number of layers that is used during
compilation of blender.
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_hair.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index d5923419b37..8320ae55179 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -115,12 +115,12 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex( /* TODO optimize this. Only bind the ones GPUMaterial needs. */ for (int i = 0; i < hair_cache->num_uv_layers; ++i) { - for (int n = 0; hair_cache->uv_layer_names[i][n][0] != '\0'; ++n) { + for (int n = 0; n < MAX_LAYER_NAME_CT && hair_cache->uv_layer_names[i][n][0] != '\0'; ++n) { DRW_shgroup_uniform_texture(shgrp, hair_cache->uv_layer_names[i][n], hair_cache->uv_tex[i]); } } for (int i = 0; i < hair_cache->num_col_layers; ++i) { - for (int n = 0; hair_cache->col_layer_names[i][n][0] != '\0'; ++n) { + for (int n = 0; n < MAX_LAYER_NAME_CT && hair_cache->col_layer_names[i][n][0] != '\0'; ++n) { DRW_shgroup_uniform_texture(shgrp, hair_cache->col_layer_names[i][n], hair_cache->col_tex[i]); } } |