~ubuntu-branches/ubuntu/maverick/clamav/maverick-security

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/lib/Transforms/Utils/LowerSwitch.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2011-02-23 14:27:51 UTC
  • mfrom: (0.35.17 sid)
  • Revision ID: james.westby@ubuntu.com-20110223142751-o9xb8jyvhkh75d0n
Tags: 0.96.5+dfsg-1ubuntu1.10.10.2
* SECURITY UPDATE: denial of service via double free in vba processing
  - libclamav/vba_extract.c: set buf to NULL when it gets freed.
  - http://git.clamav.net/gitweb?p=clamav-devel.git;a=commit;h=d21fb8d975f8c9688894a8cef4d50d977022e09f
  - CVE-2011-1003

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
namespace {
31
31
  /// LowerSwitch Pass - Replace all SwitchInst instructions with chained branch
32
 
  /// instructions.  Note that this cannot be a BasicBlock pass because it
33
 
  /// modifies the CFG!
 
32
  /// instructions.
34
33
  class LowerSwitch : public FunctionPass {
35
34
  public:
36
35
    static char ID; // Pass identification, replacement for typeid
37
 
    LowerSwitch() : FunctionPass(&ID) {} 
 
36
    LowerSwitch() : FunctionPass(ID) {} 
38
37
 
39
38
    virtual bool runOnFunction(Function &F);
40
39
    
41
40
    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
42
41
      // This is a cluster of orthogonal Transforms
43
42
      AU.addPreserved<UnifyFunctionExitNodes>();
44
 
      AU.addPreservedID(PromoteMemoryToRegisterID);
 
43
      AU.addPreserved("mem2reg");
45
44
      AU.addPreservedID(LowerInvokePassID);
46
45
    }
47
46
 
50
49
      Constant* High;
51
50
      BasicBlock* BB;
52
51
 
53
 
      CaseRange() : Low(0), High(0), BB(0) { }
54
 
      CaseRange(Constant* low, Constant* high, BasicBlock* bb) :
 
52
      CaseRange(Constant *low = 0, Constant *high = 0, BasicBlock *bb = 0) :
55
53
        Low(low), High(high), BB(bb) { }
56
54
    };
57
55
 
81
79
}
82
80
 
83
81
char LowerSwitch::ID = 0;
84
 
static RegisterPass<LowerSwitch>
85
 
X("lowerswitch", "Lower SwitchInst's to branches");
 
82
INITIALIZE_PASS(LowerSwitch, "lowerswitch",
 
83
                "Lower SwitchInst's to branches", false, false);
86
84
 
87
85
// Publically exposed interface to pass...
88
 
const PassInfo *const llvm::LowerSwitchID = &X;
 
86
char &llvm::LowerSwitchID = LowerSwitch::ID;
89
87
// createLowerSwitchPass - Interface to this file...
90
88
FunctionPass *llvm::createLowerSwitchPass() {
91
89
  return new LowerSwitch();