GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage/nodes/benchmark/out/../src/node_revert.h Lines: 0 3 0.0 %
Date: 2019-01-07 12:15:22 Branches: 0 0 - %

Line Branch Exec Source
1
#ifndef SRC_NODE_REVERT_H_
2
#define SRC_NODE_REVERT_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#include "node.h"
7
8
/**
9
 * Note that it is expected for this list to vary across specific LTS and
10
 * Stable versions! Only CVE's whose fixes require *breaking* changes within
11
 * a given LTS or Stable may be added to this list, and only with TSC
12
 * consensus.
13
 *
14
 * For *master* this list should always be empty!
15
 **/
16
namespace node {
17
18
#define SECURITY_REVERSIONS(XX)
19
//  XX(CVE_2016_PEND, "CVE-2016-PEND", "Vulnerability Title")
20
21
enum reversion {
22
#define V(code, ...) SECURITY_REVERT_##code,
23
  SECURITY_REVERSIONS(V)
24
#undef V
25
};
26
27
extern unsigned int reverted;
28
29
inline const char* RevertMessage(const reversion cve) {
30
#define V(code, label, msg) case SECURITY_REVERT_##code: return label ": " msg;
31
  switch (cve) {
32
    SECURITY_REVERSIONS(V)
33
    default:
34
      return "Unknown";
35
  }
36
#undef V
37
}
38
39
inline void Revert(const reversion cve) {
40
  reverted |= 1 << cve;
41
  printf("SECURITY WARNING: Reverting %s\n", RevertMessage(cve));
42
}
43
44
inline void Revert(const char* cve) {
45
#define V(code, label, _)                                                     \
46
  if (strcmp(cve, label) == 0) return Revert(SECURITY_REVERT_##code);
47
  SECURITY_REVERSIONS(V)
48
#undef V
49
  printf("Error: Attempt to revert an unknown CVE [%s]\n", cve);
50
  exit(12);
51
}
52
53
inline bool IsReverted(const reversion cve) {
54
  return reverted & (1 << cve);
55
}
56
57
inline bool IsReverted(const char* cve) {
58
#define V(code, label, _)                                                     \
59
  if (strcmp(cve, label) == 0) return IsReverted(SECURITY_REVERT_##code);
60
  SECURITY_REVERSIONS(V)
61
  return false;
62
#undef V
63
}
64
65
}  // namespace node
66
67
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
68
69
#endif  // SRC_NODE_REVERT_H_