~ubuntu-branches/ubuntu/wily/clamav/wily-proposed

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/lib/Analysis/IntervalPartition.cpp

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Sebastian Andrzej Siewior, Andreas Cadhalpun, Scott Kitterman, Javier Fernández-Sanguino
  • Date: 2015-01-28 00:25:13 UTC
  • mfrom: (0.48.14 sid)
  • Revision ID: package-import@ubuntu.com-20150128002513-lil2oi74cooy4lzr
Tags: 0.98.6+dfsg-1
[ Sebastian Andrzej Siewior ]
* update "fix-ssize_t-size_t-off_t-printf-modifier", include of misc.h was
  missing but was pulled in via the systemd patch.
* Don't leak return codes from libmspack to clamav API. (Closes: #774686).

[ Andreas Cadhalpun ]
* Add patch to avoid emitting incremental progress messages when not
  outputting to a terminal. (Closes: #767350)
* Update lintian-overrides for unused-file-paragraph-in-dep5-copyright.
* clamav-base.postinst: always chown /var/log/clamav and /var/lib/clamav
  to clamav:clamav, not only on fresh installations. (Closes: #775400)
* Adapt the clamav-daemon and clamav-freshclam logrotate scripts,
  so that they correctly work under systemd.
* Move the PidFile variable from the clamd/freshclam configuration files
  to the init scripts. This makes the init scripts more robust against
  misconfiguration and avoids error messages with systemd. (Closes: #767353)
* debian/copyright: drop files from Files-Excluded only present in github
  tarballs
* Drop Workaround-a-bug-in-libc-on-Hurd.patch, because hurd got fixed.
  (see #752237)
* debian/rules: Remove useless --with-system-tommath --without-included-ltdl
  configure options.

[ Scott Kitterman ]
* Stop stripping llvm when repacking the tarball as the system llvm on some
  releases is too old to use
* New upstream bugfix release
  - Library shared object revisions.
  - Includes a patch from Sebastian Andrzej Siewior making ClamAV pid files
    compatible with systemd.
  - Fix a heap out of bounds condition with crafted Yoda's crypter files.
    This issue was discovered by Felix Groebert of the Google Security Team.
  - Fix a heap out of bounds condition with crafted mew packer files. This
    issue was discovered by Felix Groebert of the Google Security Team.
  - Fix a heap out of bounds condition with crafted upx packer files. This
    issue was discovered by Kevin Szkudlapski of Quarkslab.
  - Fix a heap out of bounds condition with crafted upack packer files. This
    issue was discovered by Sebastian Andrzej Siewior. CVE-2014-9328.
  - Compensate a crash due to incorrect compiler optimization when handling
    crafted petite packer files. This issue was discovered by Sebastian
    Andrzej Siewior.
* Update lintian override for embedded zlib to match new so version

[ Javier Fernández-Sanguino ]
* Updated Spanish Debconf template translation (Closes: #773563)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===- IntervalPartition.cpp - Interval Partition module code -------------===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is distributed under the University of Illinois Open Source
 
6
// License. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
//
 
10
// This file contains the definition of the IntervalPartition class, which
 
11
// calculates and represent the interval partition of a function.
 
12
//
 
13
//===----------------------------------------------------------------------===//
 
14
 
 
15
#include "llvm/Analysis/IntervalIterator.h"
 
16
using namespace llvm;
 
17
 
 
18
char IntervalPartition::ID = 0;
 
19
INITIALIZE_PASS(IntervalPartition, "intervals",
 
20
                "Interval Partition Construction", true, true);
 
21
 
 
22
//===----------------------------------------------------------------------===//
 
23
// IntervalPartition Implementation
 
24
//===----------------------------------------------------------------------===//
 
25
 
 
26
// releaseMemory - Reset state back to before function was analyzed
 
27
void IntervalPartition::releaseMemory() {
 
28
  for (unsigned i = 0, e = Intervals.size(); i != e; ++i)
 
29
    delete Intervals[i];
 
30
  IntervalMap.clear();
 
31
  Intervals.clear();
 
32
  RootInterval = 0;
 
33
}
 
34
 
 
35
void IntervalPartition::print(raw_ostream &O, const Module*) const {
 
36
  for(unsigned i = 0, e = Intervals.size(); i != e; ++i)
 
37
    Intervals[i]->print(O);
 
38
}
 
39
 
 
40
// addIntervalToPartition - Add an interval to the internal list of intervals,
 
41
// and then add mappings from all of the basic blocks in the interval to the
 
42
// interval itself (in the IntervalMap).
 
43
//
 
44
void IntervalPartition::addIntervalToPartition(Interval *I) {
 
45
  Intervals.push_back(I);
 
46
 
 
47
  // Add mappings for all of the basic blocks in I to the IntervalPartition
 
48
  for (Interval::node_iterator It = I->Nodes.begin(), End = I->Nodes.end();
 
49
       It != End; ++It)
 
50
    IntervalMap.insert(std::make_pair(*It, I));
 
51
}
 
52
 
 
53
// updatePredecessors - Interval generation only sets the successor fields of
 
54
// the interval data structures.  After interval generation is complete,
 
55
// run through all of the intervals and propagate successor info as
 
56
// predecessor info.
 
57
//
 
58
void IntervalPartition::updatePredecessors(Interval *Int) {
 
59
  BasicBlock *Header = Int->getHeaderNode();
 
60
  for (Interval::succ_iterator I = Int->Successors.begin(),
 
61
         E = Int->Successors.end(); I != E; ++I)
 
62
    getBlockInterval(*I)->Predecessors.push_back(Header);
 
63
}
 
64
 
 
65
// IntervalPartition ctor - Build the first level interval partition for the
 
66
// specified function...
 
67
//
 
68
bool IntervalPartition::runOnFunction(Function &F) {
 
69
  // Pass false to intervals_begin because we take ownership of it's memory
 
70
  function_interval_iterator I = intervals_begin(&F, false);
 
71
  assert(I != intervals_end(&F) && "No intervals in function!?!?!");
 
72
 
 
73
  addIntervalToPartition(RootInterval = *I);
 
74
 
 
75
  ++I;  // After the first one...
 
76
 
 
77
  // Add the rest of the intervals to the partition.
 
78
  for (function_interval_iterator E = intervals_end(&F); I != E; ++I)
 
79
    addIntervalToPartition(*I);
 
80
 
 
81
  // Now that we know all of the successor information, propagate this to the
 
82
  // predecessors for each block.
 
83
  for (unsigned i = 0, e = Intervals.size(); i != e; ++i)
 
84
    updatePredecessors(Intervals[i]);
 
85
  return false;
 
86
}
 
87
 
 
88
 
 
89
// IntervalPartition ctor - Build a reduced interval partition from an
 
90
// existing interval graph.  This takes an additional boolean parameter to
 
91
// distinguish it from a copy constructor.  Always pass in false for now.
 
92
//
 
93
IntervalPartition::IntervalPartition(IntervalPartition &IP, bool)
 
94
  : FunctionPass(ID) {
 
95
  assert(IP.getRootInterval() && "Cannot operate on empty IntervalPartitions!");
 
96
 
 
97
  // Pass false to intervals_begin because we take ownership of it's memory
 
98
  interval_part_interval_iterator I = intervals_begin(IP, false);
 
99
  assert(I != intervals_end(IP) && "No intervals in interval partition!?!?!");
 
100
 
 
101
  addIntervalToPartition(RootInterval = *I);
 
102
 
 
103
  ++I;  // After the first one...
 
104
 
 
105
  // Add the rest of the intervals to the partition.
 
106
  for (interval_part_interval_iterator E = intervals_end(IP); I != E; ++I)
 
107
    addIntervalToPartition(*I);
 
108
 
 
109
  // Now that we know all of the successor information, propagate this to the
 
110
  // predecessors for each block.
 
111
  for (unsigned i = 0, e = Intervals.size(); i != e; ++i)
 
112
    updatePredecessors(Intervals[i]);
 
113
}
 
114