diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-07-02 17:58:08 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-07-04 10:40:18 +0100 |
commit | 12799e9be77c85eba11f70523d6ca9112266adae (patch) | |
tree | 3fdbef5fac90330baf0488a6163a989faa81a58c /fitz/filt_predict.c | |
parent | e8a68936e9dbf3b407e6ccd2c7bc75fdaa7cbbb3 (diff) | |
download | mupdf-12799e9be77c85eba11f70523d6ca9112266adae.tar.xz |
Prediction filter assumes it's writing to zeroed memory.
The putcomponent function assumes the function has been cleared.
Simple fix to clear bytes at the start of each scanline.
Problem seen with normal_217.pdf
Diffstat (limited to 'fitz/filt_predict.c')
-rw-r--r-- | fitz/filt_predict.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fitz/filt_predict.c b/fitz/filt_predict.c index 5fbd7d1d..ebd712fd 100644 --- a/fitz/filt_predict.c +++ b/fitz/filt_predict.c @@ -63,9 +63,11 @@ fz_predict_tiff(fz_predict *state, unsigned char *out, unsigned char *in, int le { int left[MAXC]; int i, k; + const int mask = (1 << state->bpc)-1; for (k = 0; k < state->colors; k++) left[k] = 0; + memset(out, 0, state->stride); for (i = 0; i < state->columns; i++) { @@ -73,7 +75,7 @@ fz_predict_tiff(fz_predict *state, unsigned char *out, unsigned char *in, int le { int a = getcomponent(in, i * state->colors + k, state->bpc); int b = a + left[k]; - int c = b % (1 << state->bpc); + int c = b & mask; putcomponent(out, i * state->colors + k, state->bpc, c); left[k] = c; } |