diff options
author | Robin Watts <robin.watts@artifex.com> | 2015-03-26 18:55:48 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-03-26 18:56:55 +0000 |
commit | 8a617ee3ae814fabdb526d5a7763764a2c88c736 (patch) | |
tree | 941419632f483c68cdd71b6ca16170231bb7b975 /source/fitz/draw-blend.c | |
parent | 44e18279d2368b5fbd4534f55b591b2b5c5aadeb (diff) | |
download | mupdf-8a617ee3ae814fabdb526d5a7763764a2c88c736.tar.xz |
Avoid division by 0 in blend calls.
If b is out of range (-ve), then this can let s == 0 and we can get
failures.
Diffstat (limited to 'source/fitz/draw-blend.c')
-rw-r--r-- | source/fitz/draw-blend.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/fitz/draw-blend.c b/source/fitz/draw-blend.c index ea5d30bc..57aa28b1 100644 --- a/source/fitz/draw-blend.c +++ b/source/fitz/draw-blend.c @@ -75,7 +75,7 @@ static inline int fz_lighten_byte(int b, int s) static inline int fz_color_dodge_byte(int b, int s) { s = 255 - s; - if (b == 0) + if (b <= 0) return 0; else if (b >= s) return 255; @@ -86,7 +86,7 @@ static inline int fz_color_dodge_byte(int b, int s) static inline int fz_color_burn_byte(int b, int s) { b = 255 - b; - if (b == 0) + if (b <= 0) return 255; else if (b >= s) return 0; |