[erlang-questions] binary_to_term and Leaking Atoms
Tony Arcieri
tony@REDACTED
Fri Oct 2 23:12:55 CEST 2009
On Thu, Oct 1, 2009 at 10:42 PM, Jayson Vantuyl <kagato@REDACTED> wrote:
> I'm working on a network protocol. The easy way to do it is just use
> term_to_binary and binary_to_term. There is one problem, though.
>
> I don't necessarily trust the sender of these binaries. It seems that
> decoding them should be relatively safe, except for the potential for
> someone to leak atoms by creating a large number of atoms until I run out of
> memory. I presume this sort of thing is the reason that
> binary_to_existing_atom (and list_to_existing_atom) were created.
>
> A few questions:
>
> 1. Is there any facility to "safely" decode binaries?
>
You might check out mojombo's BERT (Binary ERlang Term) serialization
format:
http://github.com/mojombo/ernie
--
Tony Arcieri
Medioh/Nagravision
More information about the erlang-questions
mailing list