-
Notifications
You must be signed in to change notification settings - Fork 99
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
Buffer overflow possible with d2fixed() and friends #197
Comments
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I know there are several other issues open on this related topic,
but I believe this would be slightly solution - hard fail please,
This bit of code will cause ryu to overflow its buffer:
d2fixed(1.0, 5000);
d2exp() will also do this,
both allocate a buffer = malloc(2000)
and then will blindly write as many characters as demanded by the precision parameter.
In my example requests 5000 precision, and ryu will try and write 5003 characters into the 2000 byte buffers.
I think you could set a hard max precision allowed, and abort() or fail or whatever.
Anything would be better than overflowing the buffer!
The text was updated successfully, but these errors were encountered: