diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-09-22 17:55:08 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-09-22 17:55:08 -0400 |
commit | 05cef96d9e63a00b319f88343cf9869c8e612843 (patch) | |
tree | 943e4bfddf430d917ab8742de9a291d787a9e704 /include/stdio_ext.h | |
parent | 3e936ce81bbbcc968f576aedbd5203621839f152 (diff) | |
download | musl-05cef96d9e63a00b319f88343cf9869c8e612843.tar.gz musl-05cef96d9e63a00b319f88343cf9869c8e612843.tar.bz2 musl-05cef96d9e63a00b319f88343cf9869c8e612843.tar.xz musl-05cef96d9e63a00b319f88343cf9869c8e612843.zip |
fix incorrect sequence generation in *rand48 prng functions
patch by Jens Gustedt. this fixes a bug reported by Nadav Har'El. the
underlying issue was that a left-shift by 16 bits after promotion of
unsigned short to int caused integer overflow. while some compilers
define this overflow case as "shifting into the sign bit", doing so
doesn't help; the sign bit then gets extended through the upper bits
in subsequent arithmetic as unsigned long long. this patch imposes a
promotion to unsigned prior to the shift, so that the result is
well-defined and matches the specified behavior.
Diffstat (limited to 'include/stdio_ext.h')
0 files changed, 0 insertions, 0 deletions