Yahoo!'s mailer delivered the report about nowrap_add() to my spam
folder, apparently because it thinks that the signature attachments
"may contain harmful content". :-(
nowrap_add() checks for signed overflow after the fact, so after
undefined behavior if that happens.
This rewrites nowrap_add() and moves it from end.c to integer.h.
I haven't generated any values big enough to exercise it, but the
algorithm is straightforward so I'll take it on faith.
Pull request from mkuoppal: avoid integer overflow when user types
digits and they're combined into a number by successively multiplying
intermediate value by 10 and adding new digit. Needed to avoid
triggering undefined behavior if the value overflows the largest
signed integer (actually long int).
This is a much more general fix than the code in the pull request,
which imposed an arbitrary limit for one aspect of tty input.
I'm not convinced that integer.h was the right place to add the new
AppendLongDigit() macro. I may not have caught all the places where
it is needed. files.c accumulates a value from digits but uses
unsigned int, so overflow won't trigger undefined behavior (although
it presumably ends up with a different value than what was intended).
options.c and coloratt.c accumulate smaller integers and have a limit
on the number of digits they'll use, so can't overflow.
Fixes#1254
The VMS compiler supports C99 and defines __STDC_VERSION__ to the
corresponding value, but it doesn't supply <stdint.h> so isaac64.c
wouldn't compile. It does supply another header containing what is
needed.
GCC doesn't set __STDC_VERSION__ for older versions. It is verified to
be set by default on 5.3.0.
Older versions set __INT64_MAX__ though (oldest version tested is
4.5.4).
If compilation with older GCC versions is required, set -std=c99. Even
3.4.6 is supported with this setting.
move some system-specific seed-related stuff from hacklib.c to
a system-specific source file and #define SYS_RANDOM_SEED to
utilize it during build.
Windows changes for random seed generation using
crypto next gen (CNG) api routines.
Corresponding vms changes due to disentangling of VMS and
unix when the unix seed bits got moved (untested).