Fix load of multiple unsigned bytecodes (bb #1924)

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).
0.96
Török Edvin 16 years ago
parent ecdd4de7d3
commit 2f995d9abc
  1. 4
      ChangeLog
  2. 8
      libclamav/c++/ClamBCRTChecks.cpp

@ -1,3 +1,7 @@
Mon Apr 5 22:41:40 EEST 2010 (edwin)
-------------------------------------
* libclamav/c++/bytecode2llvm.cpp: Fix load of multiple unsigned bytecodes (bb #1924)
Sat Apr 3 21:05:35 EEST 2010 (edwin)
-------------------------------------
* contrib/split-tarball.sh: update to work with 0.96

@ -65,6 +65,14 @@ namespace {
PtrVerifier() : FunctionPass((intptr_t)&ID),rootNode(0) {}
virtual bool runOnFunction(Function &F) {
#ifndef CLAMBC_COMPILER
// Bytecode was already verifier and had stack protector applied.
// We get called again because ALL bytecode functions loaded are part of
// the same module.
if (F.hasFnAttr(Attribute::StackProtectReq))
return false;
#endif
DEBUG(F.dump());
Changed = false;
BaseMap.clear();

Loading…
Cancel
Save