diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-17 14:08:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-17 14:08:25 +0300 |
commit | e0871e07dfff7babbfc03d62d565b37320e10c75 (patch) | |
tree | 0f93bb5b9845d52264326731607f2db71a7ce8ec /source/blender/imbuf/intern/scaling.c | |
parent | 172f3337cef1859625d527c988c425e3bf46fee9 (diff) |
bugfix [#26502] segmentationfault on pressing button to browse existing images for UV window
really old one!, since initial commit blender would crash scaling down large sizes eg: 60962 -> 128 (width or height).
the problem is scaledownx/y doesn't check buffer endpoints, with really large images theres a loop on a float value which can fail with large image sizes.
previous commit added asserts if the buffer runs over (assuming it doesnt crash),
This commit changes an epsilon value, tested this with random small images as well as images over 200,000 px, and it works fine, this is still flakey though and for really really big images it probably still fails.
Diffstat (limited to 'source/blender/imbuf/intern/scaling.c')
-rw-r--r-- | source/blender/imbuf/intern/scaling.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index 4cf917410c8..541f4586afb 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -863,7 +863,7 @@ static struct ImBuf *scaledownx(struct ImBuf *ibuf, int newx) rectf_end= ibuf->rect_float + (ibuf->x * ibuf->y * sizeof(float) * 4); } - add = (ibuf->x - 0.001) / newx; + add = (ibuf->x - 0.01) / newx; if (do_rect) { rect = (uchar *) ibuf->rect; @@ -993,7 +993,7 @@ static struct ImBuf *scaledowny(struct ImBuf *ibuf, int newy) rectf_end= ibuf->rect_float + (ibuf->x * ibuf->y * sizeof(float) * 4); } - add = (ibuf->y - 0.001) / newy; + add = (ibuf->y - 0.01) / newy; skipx = 4 * ibuf->x; for (x = skipx - 4; x>=0 ; x-= 4) { |