[Bf-blender-cvs] [f09480b2125] blender2.8: Hair drawing: respect the amount of layers.
Jeroen Bakker
noreply at git.blender.org
Thu Jun 28 11:01:26 CEST 2018
Commit: f09480b2125c6125212fb3f057ebb4a9061bc134
Author: Jeroen Bakker
Date: Thu Jun 28 10:35:48 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBf09480b2125c6125212fb3f057ebb4a9061bc134
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.
===================================================================
M source/blender/draw/intern/draw_hair.c
===================================================================
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]);
}
}
More information about the Bf-blender-cvs
mailing list