[Win64] Improve the computation of random seed from stack address.

This commit is contained in:
suzuki toshiya 2009-09-10 16:09:55 +09:00
parent fecb7a60fa
commit 0729bc9f52
3 changed files with 22 additions and 6 deletions

View File

@ -1,3 +1,17 @@
2009-09-10 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[Win64] Improve the computation of random seed from stack address.
On LLP64 platform, the conversion from pointer to FT_Fixed need
to drop higher 32-bit. Explict casts are required. Reported by
NightStrike from MinGW-w64 project. See
http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html
* src/cff/cffgload.c: Convert the pointers to FT_Fixed explicitly.
* src/psaux/t1decode.c: Ditto.
2009-09-03 Werner Lemberg <wl@gnu.org>
[raster] Improvements for stand-alone mode.

View File

@ -878,9 +878,10 @@
decoder->read_width = 1;
/* compute random seed from stack address of parameter */
seed = (FT_Fixed)(char*)&seed ^
(FT_Fixed)(char*)&decoder ^
(FT_Fixed)(char*)&charstring_base;
seed = (FT_Fixed)( ( (FT_PtrDist)(char*)&seed ^
(FT_PtrDist)(char*)&decoder ^
(FT_PtrDist)(char*)&charstring_base ) &
FT_ULONG_MAX ) ;
seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
if ( seed == 0 )
seed = 0x7384;

View File

@ -376,9 +376,10 @@
/* compute random seed from stack address of parameter */
seed = (FT_Fixed)(char*)&seed ^
(FT_Fixed)(char*)&decoder ^
(FT_Fixed)(char*)&charstring_base;
seed = (FT_Fixed)( ( (FT_PtrDist)(char*)&seed ^
(FT_PtrDist)(char*)&decoder ^
(FT_PtrDist)(char*)&charstring_base ) &
FT_ULONG_MAX ) ;
seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
if ( seed == 0 )
seed = 0x7384;