[erlang-bugs] erlang:binary_to_integer(<<"+">>) returns 0

Mikael Pettersson mikpelinux@REDACTED
Fri Jul 31 21:26:40 CEST 2015


-E:), niku writes:
 > Hi folks.
 > 
 > erlang:binary_to_integer(<<"+">>) and
 > erlang:binary_to_integer(<<"-">>) return 0
 > 
 > I think it should cause exception same as erlang:list_to_integer("+").
 > 
 > Here is an example
 > 
 > $ erl
 > Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:4:4]
 > [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
 > 
 > Eshell V6.4  (abort with ^G)
 > 1> binary_to_integer(<<"+">>).
 > 0
 > 2> binary_to_integer(<<"-">>).
 > 0
 > 
 > regards.

Confirmed with otp 18.0.2.

Fix:
https://github.com/erlang/otp/pull/803



More information about the erlang-bugs mailing list