diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-02-22 18:03:13 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-02-22 18:03:13 +0300 |
commit | 494538db13879923c3749a379f22ba65835def4c (patch) | |
tree | e07f80c1b436049fcbee425771822e254def3cbb /source/blender/render | |
parent | 85b7e19805946d73957e7a121d3cf5136194f43e (diff) |
Fix integer overflow problem in deep shadow buffer.
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/shadbuf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index 10cbd82fb1b..954ff373c89 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -986,8 +986,9 @@ static float readdeepvisibility(DeepSample *dsample, int tot, int z, int bias, f if(a == 0) return 1.0f; /* completely in front of all samples */ + /* converting to float early here because ds->z - prevds->z can overflow */ prevds= ds-1; - t= (float)(z-bias - prevds->z)/(float)(ds->z - prevds->z); + t= ((float)(z-bias) - (float)prevds->z)/((float)ds->z - (float)prevds->z); return t*ds->v + (1.0f-t)*prevds->v; } |