This is LLVM SVN r102604:
Limit alignment in SmallVector 8, otherwise GCC assumes 16 byte alignment.
opetaror new, and malloc only return 8-byte aligned memory on 32-bit Linux,
which cause a crash if code is compiled with -O3 (or -ftree-vectorize) and some
SmallVector code is vectorized.
We defined WORDS_BIGENDIAN to 0 if it wasn't defined, however that doesn't work with Apple universal
builds, since we don't know the endianness at configure time!
So add the ifndef WORDS_BIGNENDIAN -> define WORDS_BIGENDIAN 0 logic to
platform.h.
RedHat's version (3.4.6 20060404 (Red Hat 3.4.6-11) is buggy, see http://farm.0xacab.net/build/show/6292
FreeBSD's version appears to work, they can pass --enable-llvm, and if make
check passes use it.
fd == 0 is used to mark an invalid fd (not fd -1).
Test that tempfile is not NULL before calling cli_unlink
(that is the cause of the Bad address errors).
Also call cli_unlink when a virus is found. This isn't strictly
necessary since the file will get removed by the parent's rmdirs(),
but there is no point in leaving it behind.
All bytecode functions are loaded in a single module, the bounds verifier is
run, and then stack protectors are inserted.
The problem is that when the next bytecode function is loaded, all functions get
run through the verifier again (including those which got the stack protector
applied), and the bounds verifier rejects it (it doesn't know about stack
protectors).
The fix is to skip running the bounds verifier when a function already has the
stack protector applied, when run in libclamav.
This affects only loading of multiple unsigned bytecodes, or an unsigned
bytecode + bytecode.cvd.
Load of a single unsigned bytecode works, and load of multiple signed bytecodes
is not affected (since the verifier is skipped there).