package mopsa

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file builtins.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
(****************************************************************************)
(*                                                                          *)
(* This file is part of MOPSA, a Modular Open Platform for Static Analysis. *)
(*                                                                          *)
(* Copyright (C) 2017-2019 The MOPSA Project.                               *)
(*                                                                          *)
(* This program is free software: you can redistribute it and/or modify     *)
(* it under the terms of the GNU Lesser General Public License as published *)
(* by the Free Software Foundation, either version 3 of the License, or     *)
(* (at your option) any later version.                                      *)
(*                                                                          *)
(* This program is distributed in the hope that it will be useful,          *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of           *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *)
(* GNU Lesser General Public License for more details.                      *)
(*                                                                          *)
(* You should have received a copy of the GNU Lesser General Public License *)
(* along with this program.  If not, see <http://www.gnu.org/licenses/>.    *)
(*                                                                          *)
(****************************************************************************)


(** List of builtin functions *)
let builtin_functions = Hashtbl.create 16

let _ =
  List.iter (fun a -> Hashtbl.add builtin_functions a ()) [
      "__builtin_constant_p";
      "__builtin_expect";

      "__builtin_va_start";
      "__builtin_va_end";
      "__builtin_va_copy";

      "__builtin_alloca";
      "alloca";

      "printf";
      "__printf_chk";
      "fprintf";
      "__fprintf_chk";
      "dprintf";
      "sprintf";
      "__sprintf_chk";
      "__builtin___sprintf_chk";
      "snprintf";
      "asprintf";
      "vasprintf";
      "fscanf";
      "scanf";
      "sscanf";

      "fwprintf";
      "wprintf";
      "swprintf";

      "syslog";

      "_mopsa_rand_s8";
      "_mopsa_rand_u8";
      "_mopsa_rand_s16";
      "_mopsa_rand_u16";
      "_mopsa_rand_s32";
      "_mopsa_rand_u32";
      "_mopsa_rand_s64";
      "_mopsa_rand_u64";
      "_mopsa_rand_float";
      "_mopsa_rand_double";
      "_mopsa_rand_void_pointer";

      "_mopsa_range_s8";
      "_mopsa_range_u8";
      "_mopsa_range_s16";
      "_mopsa_range_u16";
      "_mopsa_range_s32";
      "_mopsa_range_u32";
      "_mopsa_range_s64";
      "_mopsa_range_u64";
      "_mopsa_range_int";
      "_mopsa_range_float";
      "_mopsa_range_double";

      "_mopsa_invalid_pointer";

      "_mopsa_panic";
      "_mopsa_print";

      "_mopsa_assume";

      "_mopsa_assert_exists";
      "_mopsa_assert";
      "_mopsa_assert_safe";
      "_mopsa_assert_unsafe";
      "_mopsa_assert_unreachable";
      "_mopsa_assert_reachable";

      "_mopsa_register_file_resource";
      "_mopsa_register_file_resource_at";
      "_mopsa_find_file_resource";

      (* "error"; *)
      (* "error_at_line"; *)

      "exit";
      "quick_exit";

      "__builtin_isfinite";
      "__builtin_isnormal";
      "__builtin_isnan";
      "__builtin_isinf_sign";
      "__builtin_huge_val";
      "__builtin_huge_valf";
      "__builtin_huge_vall";
      "__builtin_inff";
      "__builtin_nanf";
      "__builtin_signbit";
      "__builtin_fpclassify";
      "__builtin_isgreater";
      "__builtin_isgreaterequal";
      "__builtin_isless";
      "__builtin_islessequal";
      "__builtin_islessgreater";
      "__builtin_isunordered";

      "__builtin_sadd_overflow";
      "__builtin_saddl_overflow";
      "__builtin_saddll_overflow";
      "__builtin_uadd_overflow";
      "__builtin_uaddl_overflow";
      "__builtin_uaddll_overflow";
      "__builtin_smul_overflow";
      "__builtin_smull_overflow";
      "__builtin_smulll_overflow";
      "__builtin_umul_overflow";
      "__builtin_umull_overflow";
      "__builtin_umulll_overflow";

      "__builtin___memcpy_chk";
      "__builtin___memmove_chk";
      "__builtin___memset_chk";
      "__builtin___strcpy_chk"

    ]

let is_builtin_function = Hashtbl.mem builtin_functions
OCaml

Innovation. Community. Security.