SPIRV-Tools/source/util
David Neto 2937538210
Fix undef behaviour in hex float parsing (#5025)
When the parser saw more significant hex digits than fit in
the target type, it would compute a nonsensical shift amount, resulting
in undefined behaviour.

Now, drop the excess bits, effectively truncating the significand.

Also guard against overflow of the exponent in the extraordinary (and untested)
case where we see more than, for example, 2**(32-4+1) significant hex digits
for a 32-bit float, or 2**(16-4+1) significant hex digits for a 16-bit
float.

Also guard against overflow of the indexing counting the number of
significant bits.  When that would occur silently drop any further
significant bits.  (Untested)

Avoid hex floats in C++ code. It's a C++17 feature.

Fixes: #4724
2022-12-19 15:46:57 -05:00
..
bit_vector.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
bit_vector.h Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
bitutils.h Support constant-folding UConvert and SConvert (#2960) 2019-10-16 16:29:55 -04:00
hash_combine.h Optimize Type::HashValue (#4707) 2022-02-15 18:57:39 +00:00
hex_float.h Fix undef behaviour in hex float parsing (#5025) 2022-12-19 15:46:57 -05:00
ilist_node.h Rewrite include guards (#1793) 2018-08-03 08:05:33 -04:00
ilist.h Suppress -Wunused-but-set-variable on variable (#4777) 2022-04-01 17:07:05 +01:00
make_unique.h Use MakeUnique. (#1837) 2018-08-14 15:01:50 -04:00
parse_number.cpp Use MakeUnique. (#1837) 2018-08-14 15:01:50 -04:00
parse_number.h Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
small_vector.h Optimize Type::HashValue (#4707) 2022-02-15 18:57:39 +00:00
string_utils.cpp Add option for the max id bound. (#1870) 2018-09-10 11:49:41 -04:00
string_utils.h Fix endianness of string literals (#4622) 2021-12-08 12:01:26 -05:00
timer.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
timer.h Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00