Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
|
|
|
|
|
|
Place HighestVersion before LowestVersion, since that is what the
source code does (erl_epmd.erl and epmd_srv.c).
|
|
|
|
|
|
|
|
* dgud/emacs-improvements:
Emacs: Added indentation inside parenthesis
More -spec indentation fixes.
|
|
Used in records or tuple creation:
-record(record3, {a = 8#42423 bor
8#4234,
b = 8#5432
bor 2#1010101
c = 123 +
234,
d}).
and in functions calls
call(2#42423 bor
#4234,
2#5432,
other_arg),
|
|
|
|
* at/windows_build_fixes:
Updated README.win32 for compiling with VS2008 and issues with mc.exe
Allow mc.sh and rc.sh to work when path to mc/rc.exe has spaces
OTP-8345 Building on Windows will now work if the paths to mc.exe and
rc.exe contain spaces. The README.win32 file has been updated
with some information about building using Visual Studio 2008.
(Thanks to Andrew Thompson.)
|
|
It must be unsigned so that prim_inet will not reject
when it is sent down again.
(Suggested fix by Raimo for a bug reported by Simon Cornish.)
|
|
The symbol ei_tracelevel was not declared extern which could
crash the linking step on some compilers.
Updated .gitignore to ignore object files in erl_interface.
|
|
Suggested by Vlad Dumitrescu.
|
|
Visual Studio 2008 puts some things in different places and doesn't
include the Message Compiler (mc.exe).
|
|
The eval call in these scripts was failing for me because the path to
them on my windows machine contained spaces. I also fixed some
copy/paste-os from when (evidently) the mc.sh script was created by
copying the rc.sh script and modifying it.
|
|
|
|
|
|
* sc/ei_decode_skip_fun:
Fix ei_skip_term() handling of funs encoded as NEW_FUN_EXT
|
|
|
|
|
|
|
|
In the following code
case X of foo -> 25
end,
Automatically indent the line you stand on (end,) before
adding newline and indent again.
That way 'end' will be indented correctly after the comma is written.
|
|
|
|
* sc/darwin_build_rm_dSYMN:
Fix 'make clean' in erts with debug builds under Darwin
|
|
(.eix) of erlang terms that can be read by the erldoc
application. Erldoc handles the documentation search mechanism at
erlang.org. Added generation of eix files to
otp_release_targets.mk. Fixed a copyright date error in
db_html.xsl .
|
|
The Apple compiler creates DWARF debugging symbols in a bundle (ie. a
directory) named <name>.dSYM
In order for make clean to work correctly, the rm command needs -r
|
|
|
|
|
|
* bg/on_load:
Test on_load functions that don't return 'ok'
Change the expected return value for on_load functions
OTP-8339 The expected return value for an on_load function has been
changed. (See the section about code loading in the Reference
manual.)
|
|
* bg/compiler-bopt-bug:
beam_bool: Fix generation of code that does not validate
Fix crash in beam_bool
OTP-8338 Using complex boolean expressions in ifs could cause the compiler
to either crash or teminate with an internal error. (Thanks to
Simon Cornish.)
|
|
* as/c_nc-fix:
c_SUITE: Use new style guard tests
Fix c:nc to use outdir or cwd to find compiled object file
OTP-8337 c:nc/{1,2} used to assume that the beam file was created in the
same directory as the source code and failed to load the code if
it was not. Corrected to look for the beam file in the current
directory or in the directory specified by the {outdir,Dir}
option. (Thanks to Alex Suraci.)
|
|
|
|
Before this patch, c:nc would naively assume the object file was created
in the same location as the .erl file. This is often false, for example
when an outdir is specified (often the case in make:all([netload])) or
calling with c:nc("foo/bar") (because compile:file places bar.beam in
the cwd, not foo/).
[ Squashed in minor style changes. /bg ]
|
|
bug was introduced in R13B03. (Thanks to Matthew Sackman.)
|
|
|
|
|
|
An on_load function is supposed to return 'true' to indicate
that the module should be loaded, and 'false' if it should be
unloaded. But returning any other term, as well as causing an
exception, will also unload the module.
Since we don't like boolean values mixed with other values,
change the expected return value as follows:
* If 'ok' is returned, the module will remain loaded and become
callable.
* If any other value is returned (or an exception is generated),
the module will be unloaded. Also, if the returned value is
not an atom, send a warning message to the error_logger
(using error_logger:warning_msg/2).
The new interpretation of the return value means that an on_load
function can now directly return the return value from
erlang:load_nif/2.
|
|
The following code (by Simon Cornish)
bad(XDo1, XDo2, Do3) ->
Do1 = (XDo1 =/= []),
Do2 = (XDo2 =/= []),
CH1 = if Do1 == true;
Do1 == false,Do2==false,Do3 == blah ->
ch1;
true ->
no
end,
CH2 = if Do1 == true;
Do1 == false,Do2==false,Do3 == xx ->
ch2;
true ->
no
end,
{CH1,CH2}.
is optimized by beam_bool even though the optimization is not
safe. The trouble is that an assignment to {y,0} no longer
occurs on all paths leading to its use.
The bug is in dst_regs/2 which is supposed to return a set
of all registers assigned in a code block, but it ignores
registers assigned in 'move' instructions.
Fix the bug by taking 'move' instructions into account. This change
is safe since it can only cause more registers to be added
to the MustBeKilled and MustBeUnused sets in ensure_opt_safe/6,
which means that it can only cause the optimization to be turned
off for code that used to be optimized.
|
|
new mandatory configuration variable that replaces all other
previously mandatory configuration variables, and better
documentation. Note that old cross compilation configurations
cannot be used without modifications.
For more information see the $ERL_TOP/xcomp/README file.
|
|
* po/blowfish_ecb_cbc_ofb-rebased:
Add Blowfish tests
Add Blowfish ECB, CBC and OFB modes
OTP-8331 The crypto module now supports Blowfish in ECB, CBC and OFB
modes. (Thanks to Paul Oliver.)
|
|
|
|
My previous patch added CFB mode. This patch adds all remaining
Blowfish modes. According to the man page
http://www.fifi.org/cgi-bin/man2html/usr/share/man/man3/blowfish.3ssl.gz
these are available in all versions of OpenSSL.
[ Squashed in elimination of signed/unsigned compiler warnings. /bg ]
|
|
|
|
* bg/slimmer-history:
beam_makepos: Do not put any dates in generated files
compiler: Teach 'slim' to omit compilation info
|
|
The following code crashes beam_bool:
bad(XDo1, XDo2, Do3) ->
Do1 = (XDo1 =/= []),
Do2 = (XDo2 =/= []),
if Do1 =:= true;
Do1 =:= false, Do2 =:= false, Do3 =:= delete ->
no
end.
(Reported by Simon Cornish; minimized by Kostis Sagonas.)
For the moment fix the bug in the simplest and safest way possible
(basically, instead of crashing just don't do the optimization).
In a future major release (e.g. R14), the following improvements
could be considered:
* In beam_bool, it should be possible to move the Do1 and Do2
expressions to the pre-block and still optimize the expression
in the 'if' statement.
* In sys_core_fold, it should be possible to eliminate the
try/catch around the guard expression in the 'if', because
none of the guard tests can actually fail.
|
|
|
|
We don't want to have dates in files that are checked-in as
part of the bootstrap compiler (such as beam_opcodes.{erl,hrl})
as a new version will be created every time.
|