[erlang-questions] binary_to_term and leaking atoms

Björn Gustavsson <>
Mon Jan 4 11:41:58 CET 2010


On Mon, Jan 4, 2010 at 11:23 AM, Jayson Vantuyl <> wrote:

> %% @spec binary_to_term(binary(), [ only_existing_atoms | prohibit_pid | prohibit_fun | safe ]) -> term()
> %% @doc Same as binary_to_term/1, but with special decoding options.
> %%   only_existing_atoms: prohibit creation of new atoms
> %%   prohibit_pid: prohibits creation of pids
> %%   prohibit_fun: prohibits creation of funs
> %%   safe: same as above three options, useful when decoding binaries from untrusted sources

I prefer this version, since it can be extended in the future.
(For instance, to limit the size of the decoded term.)

If you can submit a production-quality patch, this feature
could make it into R13B04. Instructions for submitting
patches are here:

http://wiki.github.com/erlang/otp/submitting-patches

While someone in the Erlang/OTP could implement this
feature, it is not likely to happen in time for the
R13B04 release.

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


More information about the erlang-questions mailing list