You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
on go tip runtime.atoi does not do any kind of overflow checks or error reporting.
which can lead to internal variables being set to surprising numbers without a warning.
martisch
changed the title
runtime: handle command line option numbers correctly
runtime: parse option numbers set through environment correctly
Nov 1, 2016
https://golang.org/cl/32390 would fixes the atoi implementation and provides a ok return value such that call sites can report an error that the option could not be set correctly if need be.
- Adds overflow checks
- Adds parsing of negative integers
- Adds boolean return value to signal parsing errors
- Adds atoi32 for parsing of integers that fit in an int32
- Adds tests
Handling of errors to provide error messages
at the call sites is left to future CLs.
Updates #17718
Change-Id: I3cacd0ab1230b9efc5404c68edae7304d39bcbc0
Reviewed-on: https://go-review.googlesource.com/32390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Thanks @martisch. The CL you submitted fixes the issue as far as I am concerned. A bad setting in the environment is not cause for failing to run the program.
on go tip runtime.atoi does not do any kind of overflow checks or error reporting.
which can lead to internal variables being set to surprising numbers without a warning.
What did you do?
compile a test program:
https://play.golang.org/p/WhUyslK_Em
supply some number value flags:
$ GODEBUG=memprofilerate=10000000000000000000 ./test
What did you expect to see?
runtime.MemProfileRate=10000000000000000000
or an error
or a documented default value
What did you see instead?
runtime.MemProfileRate=-8446744073709551616
The text was updated successfully, but these errors were encountered: