Age | Commit message (Collapse) | Author |
|
* commit 'bg/nif_error':
crypto: Add type specs for all documented functions
crypto: Use erlang:nif_error/1 to squelch false Dialyzer warnings
Add erlang:nif_error/1,2
|
|
This BIF was only used by the now broken SAE support.
|
|
A stub function that is supposed to be replaced by a NIF usually
calls erlang:error/1 to cause an exception if the NIF library
is not loaded. For example:
foo() ->
erlang:error(nif_not_loaded).
The problem is that although erlang:error/1 will normally never be
called, Dialyzer will think that any call to the function will fail
and thus generate false warnings. Adding a spec for the function
will not help because Dialyzer will not believe the spec.
Add erlang:nif_error/1,2 that work exactly like erlang:error/1,2.
Define the return types for both BIFs to be t_any().
erlang:nif_error is used like this:
-spec foo() -> binary().
foo() ->
erlang:nif_error(nif_not_loaded).
(The -spec is optional but highly recommended, since Dialyzer
otherwise has no chance to figure out the types.)
|
|
Add the gc_bif's to the VM.
Add infrastructure for gc_bif's (guard bifs that can gc) with two and.
three arguments in VM (loader and VM).
Add compiler support for gc_bif with three arguments.
Add compiler (and interpreter) support for new guard BIFs.
Add testcases for new guard BIFs in compiler and emulator.
|
|
Add testcases for encode/decode_unsigned/1,2.
|
|
Add testcases for referenced_byte_size/1.
Add failure tests for referenced_byte_size.
|
|
Add testcases for binary:list_to_bin/1 and binary:copy/1,2.
Add reference implementation of list_to_bin/1.
|
|
Add testcases for bin_to_list.
Teach binref.erl bin_to_list.
|
|
Add allcoator parameter to erts_get_aligned_binary_bytes_extra.
Add testcases for the functions above.
Add reference implementation for the functions above.
|
|
Change name of the 'scope' option for binary:match/matches.
Add split and replace to binary.erl.
Cleanup comments etc in binary.erl and atom.names
Add testcases for part, split, replace and scopes.
|
|
Add testcase embryos and reference implementation.
Change name of compile function according to EEP31.
|
|
|
|
* jv/binary_to_term-opts:
document ErtsExternalDist flags and CON_ID mask
add options to binary_to_term
OTP-8367 There is new erlang:binary_to_binary/2 BIF that takes an option
list. The option safe can be used to prevent creation of
resources that are not garbage collected (such as atoms). (Thanks
to Jayson Vantuyl.)
|
|
term_to_binary and binary_to_term are powerful tools that can be used easily in
lieu of a custom binary network protocol. Unfortunately, carefully crafted
data can be used to exhaust the memory in an Erlang node by merely attempting
to decode binaries. This makes it unsafe to receive data from untrusted
sources.
This is possible because binary_to_term/1 will allocate new atoms and new
external function references. These data structures are not garbage collected.
This patch implements the new form of binary_to_term that takes a list of
options, and a simple option called 'safe'. If specified, this option will
cause decoding to fail with a badarg error if an atom or external function
reference would be allocated.
In the general case, it will happily decode any Erlang term other than those
containing new atoms or new external function references. However, fun, pid,
and ref data types can embed atoms. They might fail to decode if one of these
embedded atoms is new to the node. This may be an issue if encoded binaries
are transferred between nodes or persisted between invocations of Erlang.
|
|
|