Yara rule files may contain multiple signatures. If one of the
signatures fails to load because of a parse error in the yara rule
condition, the rest of the rules still load. This is fine, but it seems
that something isn't properly cleaned up, so there end up being runtime
crashes when running the correctly loaded rules as a result.
Specifically, the crash occurs because of an assert() that expects the
operation stack to be empty and it is not. A simple fix is to print an
error or debug message instead of crashing. It's not the right fix, but
it at least prevents crash.
Resolves: https://bugzilla.clamav.net/show_bug.cgi?id=12077
Also fixed a bunch of warnings in the yara module caused by comparing
different integer types.
The derefence of an unaligned 64bit variable results in a SIGBUS abort
on 32bit SPARC. ARMv5 CPUs seem to perform the load but load garbish.
This memcpy() workaround forces the compiler to do something that works
on even if the data was not properly aligned. For X86 it means no
change. ARM on other hand will produce slightly different code depending
on the CPU used.
Patch-Name: libclamav-yara-avoid-unaliged-access-to-64bit-variab.patch
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Mickey Sola <msola@sourcefire.com>