Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Mein <mein@cs.umn.edu>2009-06-18 16:57:39 +0400
committerKent Mein <mein@cs.umn.edu>2009-06-18 16:57:39 +0400
commita9b99ab01c2c3ebd2131bfb50bd4b221757804d3 (patch)
treec19c95a7d4816974db83883dd04be9be5ee7a7f0
parent0489fb731afb3479df8906749fb089160cccc454 (diff)
coverity issue CID: 596
Checker: FORWARD_NULL (help) File: base/src/source/blender/render/intern/source/texture.c Function: do_lamp_tex Description: Variable "dx" tracked as NULL was dereferenced. Also found a typo the 3rd check was checking projx instead of projz I also expanded the elses to set dyt as well as dxt. Kent
-rw-r--r--source/blender/render/intern/source/texture.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c
index f2169ceea12..007b69a9b97 100644
--- a/source/blender/render/intern/source/texture.c
+++ b/source/blender/render/intern/source/texture.c
@@ -2354,7 +2354,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
float *co = NULL, *dx = NULL, *dy = NULL, fact, stencilTin=1.0;
float texvec[3], dxt[3], dyt[3], tempvec[3];
- int tex_nr, rgb= 0;
+ int i, tex_nr, rgb= 0;
if (R.r.scemode & R_NO_TEX) return;
tex_nr= 0;
@@ -2430,21 +2430,33 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
if(shi->osatex) {
- if(mtex->projx) {
- dxt[0]= mtex->size[0]*dx[mtex->projx-1];
- dyt[0]= mtex->size[0]*dy[mtex->projx-1];
- }
- else dxt[0]= 0.0;
- if(mtex->projy) {
- dxt[1]= mtex->size[1]*dx[mtex->projy-1];
- dyt[1]= mtex->size[1]*dy[mtex->projy-1];
- }
- else dxt[1]= 0.0;
- if(mtex->projx) {
- dxt[2]= mtex->size[2]*dx[mtex->projz-1];
- dyt[2]= mtex->size[2]*dy[mtex->projz-1];
+ if (!dx) {
+ for(i=0;i<2;i++) {
+ dxt[i] = dyt[i] = 0.0;
+ }
+ } else {
+ if(mtex->projx) {
+ dxt[0]= mtex->size[0]*dx[mtex->projx-1];
+ dyt[0]= mtex->size[0]*dy[mtex->projx-1];
+ } else {
+ dxt[0]= 0.0;
+ dyt[0]= 0.0;
+ }
+ if(mtex->projy) {
+ dxt[1]= mtex->size[1]*dx[mtex->projy-1];
+ dyt[1]= mtex->size[1]*dy[mtex->projy-1];
+ } else {
+ dxt[1]= 0.0;
+ dyt[1]= 0.0;
+ }
+ if(mtex->projz) {
+ dxt[2]= mtex->size[2]*dx[mtex->projz-1];
+ dyt[2]= mtex->size[2]*dy[mtex->projz-1];
+ } else {
+ dxt[2]= 0.0;
+ dyt[2]= 0.0;
+ }
}
- else dxt[2]= 0.0;
}
/* texture */