-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hex2num
is vulnerable to overflow
#22031
Comments
How about we delete this instead? It should be part of either parsing or reinterpret. In what sense does a hexadecimal string represent a floating-point number? cc @JeffBezanson; at the very least, the doc string should explain this. |
I think the difference between |
We have |
+1 for getting rid of this: I think it's a Matlab/Octave-ism that has hung around. It's also not a great pattern to encourage, as it's technically endian-dependent (if you want lossless text-based serialisation, you should be using hex float literals). |
I agree that The only registered package that seems to use this is CBOR.jl, which somewhat perversely converts bytes to a string (via |
It's also type-unstable. |
Also,
|
This is fixed in #22039 (which addresses also the |
Given #22088, is this still relevant? |
From https://discourse.julialang.org/t/bigint-to-hex-and-back-to-bigint/3873.
The documentation simply says:
and does not hint on any limit of size in the allowed hex string.
hex2num
should probably detect the overflow and try parsing the string as aBigInt
before converting it?The text was updated successfully, but these errors were encountered: