[erlang-bugs] binary_to_term can crash erl

Bjorn Gustavsson <>
Mon Feb 11 14:08:11 CET 2008


Thanks! In R12B-2 binary_to_term/1 will cause a badarg exception if
there are any atoms longer than 255 characters in the binary. Atoms created
in various ways through the driver API will be truncated to 255 characters
if necessary.

/Bjorn

"Matthew Dempsky" <> writes:

> Calling binary_to_term can cause the erl interpreter to crash:
> 
>     1> binary_to_term(iolist_to_binary([<<131, 100, 65000:16>> |
> lists:duplicate(65000, 42)])).
> 
>     Crash dump was written to: erl_crash.dump
>     absurdly large atom
>     Abort trap
> 
> I think binary_to_term should instead just kill the process that
> called binary_to_term, similar to calling list_to_atom on a list that
> is too large.
> 
> Also, it's possible to create atoms larger than 255 characters this way.
> _______________________________________________
> erlang-bugs mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-bugs
> 

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-bugs mailing list