CRC32 algorithm (Source/crc32.c) and all its callers
use unsigned long type for a crc32 value.
That works in 32bit environment, but doesn't in 64bit
environment, where unsigned long is 64bit long.
That leads for incorrect CRC32 computation, and, more
important, stack corruption when running makensis on
64bit UNIX system.
Most correct solution of this problem is to use
platform-independent fixed integer types. UINT32 type
defined in Source/Platform.h will do the trick.
crc_writer_sink class must be corrected to use UINT32.
I also suggest creating "crc32.h", where prototypes for
CRC32 will be declared. Now definitions of CRC32 are
included in Source/build.h, Source/writer.cpp and
Source/exehead/fileform.c.
Source/build.cpp needs following to prevent stack
corruption:
crc_writer_sink crc_sink((unsigned long *) &crc);
must be rewritten as
crc_writer_sink crc_sink((UINT32 *) &crc);
because on x86_64 variable crc is 32bit long (declared
as unsigned int), but unsigned long is 64bit there.
Logged In: YES
user_id=1346300
Please excuse my bad English, here is a correction for lst line
because on x86_64 variable crc is 32bit wide (declared
as unsigned int), but unsigned long is 64bit there.
Logged In: YES
user_id=584402
Thanks, fixed. I've declared crc32_t in crc32.h and used it
where needed.