[gs-cvs] rev 7961 - trunk/gs/src
alexcher at ghostscript.com
alexcher at ghostscript.com
Sat May 12 11:25:58 PDT 2007
Author: alexcher
Date: 2007-05-12 11:25:57 -0700 (Sat, 12 May 2007)
New Revision: 7961
Modified:
trunk/gs/src/gscie.h
Log:
Avoid a Valgrind warning about uninitialized memory and fix a potential
memory access violation where look-up of the last value of the interpolation
table caused access past the end of the table.
DIFFERENCES:
None.
Modified: trunk/gs/src/gscie.h
===================================================================
--- trunk/gs/src/gscie.h 2007-05-12 17:09:18 UTC (rev 7960)
+++ trunk/gs/src/gscie.h 2007-05-12 18:25:57 UTC (rev 7961)
@@ -102,10 +102,14 @@
(1 << (_cie_interpolate_bits - 1)),\
_cie_interpolate_bits))
# define cie_interpolate(p, i)\
- cie_interpolate_between((p)[_cix(i)], (p)[_cix(i) + 1], i)
+ ((i) >= (gx_cie_cache_size - 1) << _cie_interpolate_bits ? \
+ (p)[gx_cie_cache_size - 1] : \
+ cie_interpolate_between((p)[_cix(i)], (p)[_cix(i) + 1], i))
# define cie_interpolate_fracs(p, i)\
- ((p)[_cix(i)] +\
- (frac)arith_rshift((long)((p)[_cix(i) + 1] - (p)[_cix(i)]) * _cif(i), _cie_interpolate_bits))
+ ((i) >= (gx_cie_cache_size - 1) << _cie_interpolate_bits ? \
+ (p)[gx_cie_cache_size - 1] : \
+ ((p)[_cix(i)] + \
+ (frac)arith_rshift((long)((p)[_cix(i) + 1] - (p)[_cix(i)]) * _cif(i), _cie_interpolate_bits)))
#else
# define _cie_interpolate_bits 0
# define cie_interpolate_between(v0, v1, i) (v0)
More information about the gs-cvs
mailing list