1 /* 2 * ClamAV bytecode internal API 3 * This is an automatically generated file! 4 * 5 * Copyright (C) 2013-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved. 6 * Copyright (C) 2009-2013 Sourcefire, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE 28 */ 29 #include "clamav-types.h" 30 #include "type_desc.h" 31 #include "bytecode_api.h" 32 #include "bytecode_api_impl.h" 33 #include "bytecode_priv.h" 34 #include <stdlib.h> 35 36 uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx , uint32_t, uint32_t); 37 int32_t cli_bcapi_read(struct cli_bc_ctx *ctx , uint8_t*, int32_t); 38 int32_t cli_bcapi_write(struct cli_bc_ctx *ctx , uint8_t*, int32_t); 39 int32_t cli_bcapi_seek(struct cli_bc_ctx *ctx , int32_t, uint32_t); 40 uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 41 uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 42 uint32_t cli_bcapi_debug_print_uint(struct cli_bc_ctx *ctx , uint32_t); 43 uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx , struct DISASM_RESULT*, uint32_t); 44 uint32_t cli_bcapi_trace_directory(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 45 uint32_t cli_bcapi_trace_scope(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 46 uint32_t cli_bcapi_trace_source(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 47 uint32_t cli_bcapi_trace_op(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 48 uint32_t cli_bcapi_trace_value(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 49 uint32_t cli_bcapi_trace_ptr(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 50 uint32_t cli_bcapi_pe_rawaddr(struct cli_bc_ctx *ctx , uint32_t); 51 int32_t cli_bcapi_file_find(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 52 int32_t cli_bcapi_file_byteat(struct cli_bc_ctx *ctx , uint32_t); 53 uint8_t* cli_bcapi_malloc(struct cli_bc_ctx *ctx , uint32_t); 54 uint32_t cli_bcapi_test2(struct cli_bc_ctx *ctx , uint32_t); 55 int32_t cli_bcapi_get_pe_section(struct cli_bc_ctx *ctx , struct cli_exe_section*, uint32_t); 56 int32_t cli_bcapi_fill_buffer(struct cli_bc_ctx *ctx , uint8_t*, uint32_t, uint32_t, uint32_t, uint32_t); 57 int32_t cli_bcapi_extract_new(struct cli_bc_ctx *ctx , int32_t); 58 int32_t cli_bcapi_read_number(struct cli_bc_ctx *ctx , uint32_t); 59 int32_t cli_bcapi_hashset_new(struct cli_bc_ctx *ctx ); 60 int32_t cli_bcapi_hashset_add(struct cli_bc_ctx *ctx , int32_t, uint32_t); 61 int32_t cli_bcapi_hashset_remove(struct cli_bc_ctx *ctx , int32_t, uint32_t); 62 int32_t cli_bcapi_hashset_contains(struct cli_bc_ctx *ctx , int32_t, uint32_t); 63 int32_t cli_bcapi_hashset_done(struct cli_bc_ctx *ctx , int32_t); 64 int32_t cli_bcapi_hashset_empty(struct cli_bc_ctx *ctx , int32_t); 65 int32_t cli_bcapi_buffer_pipe_new(struct cli_bc_ctx *ctx , uint32_t); 66 int32_t cli_bcapi_buffer_pipe_new_fromfile(struct cli_bc_ctx *ctx , uint32_t); 67 uint32_t cli_bcapi_buffer_pipe_read_avail(struct cli_bc_ctx *ctx , int32_t); 68 const uint8_t* cli_bcapi_buffer_pipe_read_get(struct cli_bc_ctx *ctx , int32_t, uint32_t); 69 int32_t cli_bcapi_buffer_pipe_read_stopped(struct cli_bc_ctx *ctx , int32_t, uint32_t); 70 uint32_t cli_bcapi_buffer_pipe_write_avail(struct cli_bc_ctx *ctx , int32_t); 71 uint8_t* cli_bcapi_buffer_pipe_write_get(struct cli_bc_ctx *ctx , int32_t, uint32_t); 72 int32_t cli_bcapi_buffer_pipe_write_stopped(struct cli_bc_ctx *ctx , int32_t, uint32_t); 73 int32_t cli_bcapi_buffer_pipe_done(struct cli_bc_ctx *ctx , int32_t); 74 int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx , int32_t, int32_t, int32_t); 75 int32_t cli_bcapi_inflate_process(struct cli_bc_ctx *ctx , int32_t); 76 int32_t cli_bcapi_inflate_done(struct cli_bc_ctx *ctx , int32_t); 77 int32_t cli_bcapi_bytecode_rt_error(struct cli_bc_ctx *ctx , int32_t); 78 int32_t cli_bcapi_jsnorm_init(struct cli_bc_ctx *ctx , int32_t); 79 int32_t cli_bcapi_jsnorm_process(struct cli_bc_ctx *ctx , int32_t); 80 int32_t cli_bcapi_jsnorm_done(struct cli_bc_ctx *ctx , int32_t); 81 int32_t cli_bcapi_ilog2(struct cli_bc_ctx *ctx , uint32_t, uint32_t); 82 int32_t cli_bcapi_ipow(struct cli_bc_ctx *ctx , int32_t, int32_t, int32_t); 83 uint32_t cli_bcapi_iexp(struct cli_bc_ctx *ctx , int32_t, int32_t, int32_t); 84 int32_t cli_bcapi_isin(struct cli_bc_ctx *ctx , int32_t, int32_t, int32_t); 85 int32_t cli_bcapi_icos(struct cli_bc_ctx *ctx , int32_t, int32_t, int32_t); 86 int32_t cli_bcapi_memstr(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, const uint8_t*, int32_t); 87 int32_t cli_bcapi_hex2ui(struct cli_bc_ctx *ctx , uint32_t, uint32_t); 88 int32_t cli_bcapi_atoi(struct cli_bc_ctx *ctx , const uint8_t*, int32_t); 89 uint32_t cli_bcapi_debug_print_str_start(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 90 uint32_t cli_bcapi_debug_print_str_nonl(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 91 uint32_t cli_bcapi_entropy_buffer(struct cli_bc_ctx *ctx , uint8_t*, int32_t); 92 int32_t cli_bcapi_map_new(struct cli_bc_ctx *ctx , int32_t, int32_t); 93 int32_t cli_bcapi_map_addkey(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, int32_t); 94 int32_t cli_bcapi_map_setvalue(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, int32_t); 95 int32_t cli_bcapi_map_remove(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, int32_t); 96 int32_t cli_bcapi_map_find(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, int32_t); 97 int32_t cli_bcapi_map_getvaluesize(struct cli_bc_ctx *ctx , int32_t); 98 uint8_t* cli_bcapi_map_getvalue(struct cli_bc_ctx *ctx , int32_t, int32_t); 99 int32_t cli_bcapi_map_done(struct cli_bc_ctx *ctx , int32_t); 100 int32_t cli_bcapi_file_find_limit(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t, int32_t); 101 uint32_t cli_bcapi_engine_functionality_level(struct cli_bc_ctx *ctx ); 102 uint32_t cli_bcapi_engine_dconf_level(struct cli_bc_ctx *ctx ); 103 uint32_t cli_bcapi_engine_scan_options(struct cli_bc_ctx *ctx ); 104 uint32_t cli_bcapi_engine_db_options(struct cli_bc_ctx *ctx ); 105 int32_t cli_bcapi_extract_set_container(struct cli_bc_ctx *ctx , uint32_t); 106 int32_t cli_bcapi_input_switch(struct cli_bc_ctx *ctx , int32_t); 107 uint32_t cli_bcapi_get_environment(struct cli_bc_ctx *ctx , struct cli_environment*, uint32_t); 108 uint32_t cli_bcapi_disable_bytecode_if(struct cli_bc_ctx *ctx , const int8_t*, uint32_t, uint32_t); 109 uint32_t cli_bcapi_disable_jit_if(struct cli_bc_ctx *ctx , const int8_t*, uint32_t, uint32_t); 110 int32_t cli_bcapi_version_compare(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t, const uint8_t*, uint32_t); 111 uint32_t cli_bcapi_check_platform(struct cli_bc_ctx *ctx , uint32_t, uint32_t, uint32_t); 112 int32_t cli_bcapi_pdf_get_obj_num(struct cli_bc_ctx *ctx ); 113 int32_t cli_bcapi_pdf_get_flags(struct cli_bc_ctx *ctx ); 114 int32_t cli_bcapi_pdf_set_flags(struct cli_bc_ctx *ctx , int32_t); 115 int32_t cli_bcapi_pdf_lookupobj(struct cli_bc_ctx *ctx , uint32_t); 116 uint32_t cli_bcapi_pdf_getobjsize(struct cli_bc_ctx *ctx , int32_t); 117 const uint8_t* cli_bcapi_pdf_getobj(struct cli_bc_ctx *ctx , int32_t, uint32_t); 118 int32_t cli_bcapi_pdf_getobjid(struct cli_bc_ctx *ctx , int32_t); 119 int32_t cli_bcapi_pdf_getobjflags(struct cli_bc_ctx *ctx , int32_t); 120 int32_t cli_bcapi_pdf_setobjflags(struct cli_bc_ctx *ctx , int32_t, int32_t); 121 int32_t cli_bcapi_pdf_get_offset(struct cli_bc_ctx *ctx , int32_t); 122 int32_t cli_bcapi_pdf_get_phase(struct cli_bc_ctx *ctx ); 123 int32_t cli_bcapi_pdf_get_dumpedobjid(struct cli_bc_ctx *ctx ); 124 int32_t cli_bcapi_matchicon(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, const uint8_t*, int32_t); 125 int32_t cli_bcapi_running_on_jit(struct cli_bc_ctx *ctx ); 126 int32_t cli_bcapi_get_file_reliability(struct cli_bc_ctx *ctx ); 127 int32_t cli_bcapi_json_is_active(struct cli_bc_ctx *ctx ); 128 int32_t cli_bcapi_json_get_object(struct cli_bc_ctx *ctx , const int8_t*, int32_t, int32_t); 129 int32_t cli_bcapi_json_get_type(struct cli_bc_ctx *ctx , int32_t); 130 int32_t cli_bcapi_json_get_array_length(struct cli_bc_ctx *ctx , int32_t); 131 int32_t cli_bcapi_json_get_array_idx(struct cli_bc_ctx *ctx , int32_t, int32_t); 132 int32_t cli_bcapi_json_get_string_length(struct cli_bc_ctx *ctx , int32_t); 133 int32_t cli_bcapi_json_get_string(struct cli_bc_ctx *ctx , int8_t*, int32_t, int32_t); 134 int32_t cli_bcapi_json_get_boolean(struct cli_bc_ctx *ctx , int32_t); 135 int32_t cli_bcapi_json_get_int(struct cli_bc_ctx *ctx , int32_t); 136 uint32_t cli_bcapi_engine_scan_options_ex(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t); 137 int32_t cli_bcapi_lzma_init(struct cli_bc_ctx *ctx , int32_t, int32_t); 138 int32_t cli_bcapi_lzma_process(struct cli_bc_ctx *ctx , int32_t); 139 int32_t cli_bcapi_lzma_done(struct cli_bc_ctx *ctx , int32_t); 140 int32_t cli_bcapi_bzip2_init(struct cli_bc_ctx *ctx , int32_t, int32_t); 141 int32_t cli_bcapi_bzip2_process(struct cli_bc_ctx *ctx , int32_t); 142 int32_t cli_bcapi_bzip2_done(struct cli_bc_ctx *ctx , int32_t); 143 144 const struct cli_apiglobal cli_globals[] = { 145 /* Bytecode globals BEGIN */ 146 {"__clambc_match_offsets", GLOBAL_MATCH_OFFSETS, 76, 147 ((char*)&((struct cli_bc_ctx*)0)->hooks.match_offsets - (char*)NULL)}, 148 {"__clambc_kind", GLOBAL_KIND, 16, 149 ((char*)&((struct cli_bc_ctx*)0)->hooks.kind - (char*)NULL)}, 150 {"__clambc_match_counts", GLOBAL_MATCH_COUNTS, 76, 151 ((char*)&((struct cli_bc_ctx*)0)->hooks.match_counts - (char*)NULL)}, 152 {"__clambc_filesize", GLOBAL_FILESIZE, 75, 153 ((char*)&((struct cli_bc_ctx*)0)->hooks.filesize - (char*)NULL)}, 154 {"__clambc_pedata", GLOBAL_PEDATA, 69, 155 ((char*)&((struct cli_bc_ctx*)0)->hooks.pedata - (char*)NULL)} 156 /* Bytecode globals END */ 157 }; 158 const unsigned cli_apicall_maxglobal = _LAST_GLOBAL-1; 159 static uint16_t cli_tmp0[]={32, 32, 16, 16, 74, 73, 70, 32, 72, 70, 70, 32, 32, 32, 32}; 160 static uint16_t cli_tmp1[]={71}; 161 static uint16_t cli_tmp2[]={32, 32}; 162 static uint16_t cli_tmp3[]={16, 8, 8, 32, 32, 32, 32, 32, 64, 32, 32, 16, 16, 16, 16, 16, 16, 32, 32, 32, 32, 16, 16, 64, 64, 64, 64, 32, 32}; 163 static uint16_t cli_tmp4[]={16, 8, 8, 32, 32, 32, 32, 32, 32, 32, 32, 32, 16, 16, 16, 16, 16, 16, 32, 32, 32, 32, 16, 16, 32, 32, 32, 32, 32, 32}; 164 static uint16_t cli_tmp5[]={32, 16, 16, 32, 32, 32, 16, 16}; 165 static uint16_t cli_tmp6[]={32}; 166 static uint16_t cli_tmp7[]={32}; 167 static uint16_t cli_tmp8[]={32, 32}; 168 static uint16_t cli_tmp9[]={32, 32, 32}; 169 static uint16_t cli_tmp10[]={32, 65, 32}; 170 static uint16_t cli_tmp11[]={32, 65, 32, 32}; 171 static uint16_t cli_tmp12[]={32}; 172 static uint16_t cli_tmp13[]={32, 65, 32, 65, 32}; 173 static uint16_t cli_tmp14[]={65, 32, 32}; 174 static uint16_t cli_tmp15[]={32, 32, 32, 32}; 175 static uint16_t cli_tmp16[]={32, 86, 32}; 176 static uint16_t cli_tmp17[]={87}; 177 static uint16_t cli_tmp18[]={32, 32, 32, 32, 32, 32, 32, 88, 88, 88, 88, 88, 88, 88, 8, 8, 8, 8, 8, 8, 8, 8, 8}; 178 static uint16_t cli_tmp19[]={8}; 179 static uint16_t cli_tmp20[]={32, 65, 32, 32, 32, 32}; 180 static uint16_t cli_tmp21[]={32, 91, 32}; 181 static uint16_t cli_tmp22[]={92}; 182 static uint16_t cli_tmp23[]={32, 32, 32, 32, 32, 32, 32, 32, 32}; 183 static uint16_t cli_tmp24[]={65, 32}; 184 static uint16_t cli_tmp25[]={32, 95, 32}; 185 static uint16_t cli_tmp26[]={96}; 186 static uint16_t cli_tmp27[]={16, 8, 8, 8, 98, 97}; 187 static uint16_t cli_tmp28[]={8}; 188 static uint16_t cli_tmp29[]={99}; 189 static uint16_t cli_tmp30[]={8}; 190 191 const struct cli_bc_type cli_apicall_types[]={ 192 {DStructType, cli_tmp0, 15, 0, 0}, 193 {DArrayType, cli_tmp1, 16, 0, 0}, 194 {DStructType, cli_tmp2, 2, 0, 0}, 195 {DStructType, cli_tmp3, 29, 0, 0}, 196 {DStructType, cli_tmp4, 30, 0, 0}, 197 {DStructType, cli_tmp5, 8, 0, 0}, 198 {DArrayType, cli_tmp6, 1, 0, 0}, 199 {DArrayType, cli_tmp7, 64, 0, 0}, 200 {DFunctionType, cli_tmp8, 2, 0, 0}, 201 {DFunctionType, cli_tmp9, 3, 0, 0}, 202 {DFunctionType, cli_tmp10, 3, 0, 0}, 203 {DFunctionType, cli_tmp11, 4, 0, 0}, 204 {DFunctionType, cli_tmp12, 1, 0, 0}, 205 {DFunctionType, cli_tmp13, 5, 0, 0}, 206 {DFunctionType, cli_tmp14, 3, 0, 0}, 207 {DFunctionType, cli_tmp15, 4, 0, 0}, 208 {DFunctionType, cli_tmp16, 3, 0, 0}, 209 {DPointerType, cli_tmp17, 1, 0, 0}, 210 {DStructType, cli_tmp18, 23, 0, 0}, 211 {DArrayType, cli_tmp19, 65, 0, 0}, 212 {DFunctionType, cli_tmp20, 6, 0, 0}, 213 {DFunctionType, cli_tmp21, 3, 0, 0}, 214 {DPointerType, cli_tmp22, 1, 0, 0}, 215 {DStructType, cli_tmp23, 9, 0, 0}, 216 {DFunctionType, cli_tmp24, 2, 0, 0}, 217 {DFunctionType, cli_tmp25, 3, 0, 0}, 218 {DPointerType, cli_tmp26, 1, 0, 0}, 219 {DStructType, cli_tmp27, 6, 0, 0}, 220 {DArrayType, cli_tmp28, 29, 0, 0}, 221 {DArrayType, cli_tmp29, 3, 0, 0}, 222 {DArrayType, cli_tmp30, 10, 0, 0} 223 }; 224 225 const unsigned cli_apicall_maxtypes=sizeof(cli_apicall_types)/sizeof(cli_apicall_types[0]); 226 const struct cli_apicall cli_apicalls[]={ 227 /* Bytecode APIcalls BEGIN */ 228 {"test1", 9, 0, 0}, 229 {"read", 10, 0, 1}, 230 {"write", 10, 1, 1}, 231 {"seek", 9, 1, 0}, 232 {"setvirusname", 10, 2, 1}, 233 {"debug_print_str", 10, 3, 1}, 234 {"debug_print_uint", 8, 0, 2}, 235 {"disasm_x86", 25, 4, 1}, 236 {"trace_directory", 10, 5, 1}, 237 {"trace_scope", 10, 6, 1}, 238 {"trace_source", 10, 7, 1}, 239 {"trace_op", 10, 8, 1}, 240 {"trace_value", 10, 9, 1}, 241 {"trace_ptr", 10, 10, 1}, 242 {"pe_rawaddr", 8, 1, 2}, 243 {"file_find", 10, 11, 1}, 244 {"file_byteat", 8, 2, 2}, 245 {"malloc", 24, 0, 3}, 246 {"test2", 8, 3, 2}, 247 {"get_pe_section", 21, 12, 1}, 248 {"fill_buffer", 20, 0, 4}, 249 {"extract_new", 8, 4, 2}, 250 {"read_number", 8, 5, 2}, 251 {"hashset_new", 12, 0, 5}, 252 {"hashset_add", 9, 2, 0}, 253 {"hashset_remove", 9, 3, 0}, 254 {"hashset_contains", 9, 4, 0}, 255 {"hashset_done", 8, 6, 2}, 256 {"hashset_empty", 8, 7, 2}, 257 {"buffer_pipe_new", 8, 8, 2}, 258 {"buffer_pipe_new_fromfile", 8, 9, 2}, 259 {"buffer_pipe_read_avail", 8, 10, 2}, 260 {"buffer_pipe_read_get", 14, 0, 6}, 261 {"buffer_pipe_read_stopped", 9, 5, 0}, 262 {"buffer_pipe_write_avail", 8, 11, 2}, 263 {"buffer_pipe_write_get", 14, 1, 6}, 264 {"buffer_pipe_write_stopped", 9, 6, 0}, 265 {"buffer_pipe_done", 8, 12, 2}, 266 {"inflate_init", 15, 0, 7}, 267 {"inflate_process", 8, 13, 2}, 268 {"inflate_done", 8, 14, 2}, 269 {"bytecode_rt_error", 8, 15, 2}, 270 {"jsnorm_init", 8, 16, 2}, 271 {"jsnorm_process", 8, 17, 2}, 272 {"jsnorm_done", 8, 18, 2}, 273 {"ilog2", 9, 7, 0}, 274 {"ipow", 15, 1, 7}, 275 {"iexp", 15, 2, 7}, 276 {"isin", 15, 3, 7}, 277 {"icos", 15, 4, 7}, 278 {"memstr", 13, 0, 8}, 279 {"hex2ui", 9, 8, 0}, 280 {"atoi", 10, 13, 1}, 281 {"debug_print_str_start", 10, 14, 1}, 282 {"debug_print_str_nonl", 10, 15, 1}, 283 {"entropy_buffer", 10, 16, 1}, 284 {"map_new", 9, 9, 0}, 285 {"map_addkey", 11, 0, 9}, 286 {"map_setvalue", 11, 1, 9}, 287 {"map_remove", 11, 2, 9}, 288 {"map_find", 11, 3, 9}, 289 {"map_getvaluesize", 8, 19, 2}, 290 {"map_getvalue", 14, 2, 6}, 291 {"map_done", 8, 20, 2}, 292 {"file_find_limit", 11, 4, 9}, 293 {"engine_functionality_level", 12, 1, 5}, 294 {"engine_dconf_level", 12, 2, 5}, 295 {"engine_scan_options", 12, 3, 5}, 296 {"engine_db_options", 12, 4, 5}, 297 {"extract_set_container", 8, 21, 2}, 298 {"input_switch", 8, 22, 2}, 299 {"get_environment", 16, 17, 1}, 300 {"disable_bytecode_if", 11, 5, 9}, 301 {"disable_jit_if", 11, 6, 9}, 302 {"version_compare", 13, 1, 8}, 303 {"check_platform", 15, 5, 7}, 304 {"pdf_get_obj_num", 12, 5, 5}, 305 {"pdf_get_flags", 12, 6, 5}, 306 {"pdf_set_flags", 8, 23, 2}, 307 {"pdf_lookupobj", 8, 24, 2}, 308 {"pdf_getobjsize", 8, 25, 2}, 309 {"pdf_getobj", 14, 3, 6}, 310 {"pdf_getobjid", 8, 26, 2}, 311 {"pdf_getobjflags", 8, 27, 2}, 312 {"pdf_setobjflags", 9, 10, 0}, 313 {"pdf_get_offset", 8, 28, 2}, 314 {"pdf_get_phase", 12, 7, 5}, 315 {"pdf_get_dumpedobjid", 12, 8, 5}, 316 {"matchicon", 13, 2, 8}, 317 {"running_on_jit", 12, 9, 5}, 318 {"get_file_reliability", 12, 10, 5}, 319 {"json_is_active", 12, 11, 5}, 320 {"json_get_object", 11, 7, 9}, 321 {"json_get_type", 8, 29, 2}, 322 {"json_get_array_length", 8, 30, 2}, 323 {"json_get_array_idx", 9, 11, 0}, 324 {"json_get_string_length", 8, 31, 2}, 325 {"json_get_string", 11, 8, 9}, 326 {"json_get_boolean", 8, 32, 2}, 327 {"json_get_int", 8, 33, 2}, 328 {"engine_scan_options_ex", 10, 18, 1}, 329 {"lzma_init", 9, 12, 0}, 330 {"lzma_process", 8, 34, 2}, 331 {"lzma_done", 8, 35, 2}, 332 {"bzip2_init", 9, 13, 0}, 333 {"bzip2_process", 8, 36, 2}, 334 {"bzip2_done", 8, 37, 2} 335 /* Bytecode APIcalls END */ 336 }; 337 const unsigned cli_numapicalls=sizeof(cli_apicalls)/sizeof(cli_apicalls[0]); 338 339 const cli_apicall_int2 cli_apicalls0[] = { 340 (cli_apicall_int2)cli_bcapi_test1, 341 (cli_apicall_int2)cli_bcapi_seek, 342 (cli_apicall_int2)cli_bcapi_hashset_add, 343 (cli_apicall_int2)cli_bcapi_hashset_remove, 344 (cli_apicall_int2)cli_bcapi_hashset_contains, 345 (cli_apicall_int2)cli_bcapi_buffer_pipe_read_stopped, 346 (cli_apicall_int2)cli_bcapi_buffer_pipe_write_stopped, 347 (cli_apicall_int2)cli_bcapi_ilog2, 348 (cli_apicall_int2)cli_bcapi_hex2ui, 349 (cli_apicall_int2)cli_bcapi_map_new, 350 (cli_apicall_int2)cli_bcapi_pdf_setobjflags, 351 (cli_apicall_int2)cli_bcapi_json_get_array_idx, 352 (cli_apicall_int2)cli_bcapi_lzma_init, 353 (cli_apicall_int2)cli_bcapi_bzip2_init 354 }; 355 const cli_apicall_pointer cli_apicalls1[] = { 356 (cli_apicall_pointer)cli_bcapi_read, 357 (cli_apicall_pointer)cli_bcapi_write, 358 (cli_apicall_pointer)cli_bcapi_setvirusname, 359 (cli_apicall_pointer)cli_bcapi_debug_print_str, 360 (cli_apicall_pointer)cli_bcapi_disasm_x86, 361 (cli_apicall_pointer)cli_bcapi_trace_directory, 362 (cli_apicall_pointer)cli_bcapi_trace_scope, 363 (cli_apicall_pointer)cli_bcapi_trace_source, 364 (cli_apicall_pointer)cli_bcapi_trace_op, 365 (cli_apicall_pointer)cli_bcapi_trace_value, 366 (cli_apicall_pointer)cli_bcapi_trace_ptr, 367 (cli_apicall_pointer)cli_bcapi_file_find, 368 (cli_apicall_pointer)cli_bcapi_get_pe_section, 369 (cli_apicall_pointer)cli_bcapi_atoi, 370 (cli_apicall_pointer)cli_bcapi_debug_print_str_start, 371 (cli_apicall_pointer)cli_bcapi_debug_print_str_nonl, 372 (cli_apicall_pointer)cli_bcapi_entropy_buffer, 373 (cli_apicall_pointer)cli_bcapi_get_environment, 374 (cli_apicall_pointer)cli_bcapi_engine_scan_options_ex 375 }; 376 const cli_apicall_int1 cli_apicalls2[] = { 377 (cli_apicall_int1)cli_bcapi_debug_print_uint, 378 (cli_apicall_int1)cli_bcapi_pe_rawaddr, 379 (cli_apicall_int1)cli_bcapi_file_byteat, 380 (cli_apicall_int1)cli_bcapi_test2, 381 (cli_apicall_int1)cli_bcapi_extract_new, 382 (cli_apicall_int1)cli_bcapi_read_number, 383 (cli_apicall_int1)cli_bcapi_hashset_done, 384 (cli_apicall_int1)cli_bcapi_hashset_empty, 385 (cli_apicall_int1)cli_bcapi_buffer_pipe_new, 386 (cli_apicall_int1)cli_bcapi_buffer_pipe_new_fromfile, 387 (cli_apicall_int1)cli_bcapi_buffer_pipe_read_avail, 388 (cli_apicall_int1)cli_bcapi_buffer_pipe_write_avail, 389 (cli_apicall_int1)cli_bcapi_buffer_pipe_done, 390 (cli_apicall_int1)cli_bcapi_inflate_process, 391 (cli_apicall_int1)cli_bcapi_inflate_done, 392 (cli_apicall_int1)cli_bcapi_bytecode_rt_error, 393 (cli_apicall_int1)cli_bcapi_jsnorm_init, 394 (cli_apicall_int1)cli_bcapi_jsnorm_process, 395 (cli_apicall_int1)cli_bcapi_jsnorm_done, 396 (cli_apicall_int1)cli_bcapi_map_getvaluesize, 397 (cli_apicall_int1)cli_bcapi_map_done, 398 (cli_apicall_int1)cli_bcapi_extract_set_container, 399 (cli_apicall_int1)cli_bcapi_input_switch, 400 (cli_apicall_int1)cli_bcapi_pdf_set_flags, 401 (cli_apicall_int1)cli_bcapi_pdf_lookupobj, 402 (cli_apicall_int1)cli_bcapi_pdf_getobjsize, 403 (cli_apicall_int1)cli_bcapi_pdf_getobjid, 404 (cli_apicall_int1)cli_bcapi_pdf_getobjflags, 405 (cli_apicall_int1)cli_bcapi_pdf_get_offset, 406 (cli_apicall_int1)cli_bcapi_json_get_type, 407 (cli_apicall_int1)cli_bcapi_json_get_array_length, 408 (cli_apicall_int1)cli_bcapi_json_get_string_length, 409 (cli_apicall_int1)cli_bcapi_json_get_boolean, 410 (cli_apicall_int1)cli_bcapi_json_get_int, 411 (cli_apicall_int1)cli_bcapi_lzma_process, 412 (cli_apicall_int1)cli_bcapi_lzma_done, 413 (cli_apicall_int1)cli_bcapi_bzip2_process, 414 (cli_apicall_int1)cli_bcapi_bzip2_done 415 }; 416 const cli_apicall_malloclike cli_apicalls3[] = { 417 (cli_apicall_malloclike)cli_bcapi_malloc 418 }; 419 const cli_apicall_ptrbuffdata cli_apicalls4[] = { 420 (cli_apicall_ptrbuffdata)cli_bcapi_fill_buffer 421 }; 422 const cli_apicall_allocobj cli_apicalls5[] = { 423 (cli_apicall_allocobj)cli_bcapi_hashset_new, 424 (cli_apicall_allocobj)cli_bcapi_engine_functionality_level, 425 (cli_apicall_allocobj)cli_bcapi_engine_dconf_level, 426 (cli_apicall_allocobj)cli_bcapi_engine_scan_options, 427 (cli_apicall_allocobj)cli_bcapi_engine_db_options, 428 (cli_apicall_allocobj)cli_bcapi_pdf_get_obj_num, 429 (cli_apicall_allocobj)cli_bcapi_pdf_get_flags, 430 (cli_apicall_allocobj)cli_bcapi_pdf_get_phase, 431 (cli_apicall_allocobj)cli_bcapi_pdf_get_dumpedobjid, 432 (cli_apicall_allocobj)cli_bcapi_running_on_jit, 433 (cli_apicall_allocobj)cli_bcapi_get_file_reliability, 434 (cli_apicall_allocobj)cli_bcapi_json_is_active 435 }; 436 const cli_apicall_bufget cli_apicalls6[] = { 437 (cli_apicall_bufget)cli_bcapi_buffer_pipe_read_get, 438 (cli_apicall_bufget)cli_bcapi_buffer_pipe_write_get, 439 (cli_apicall_bufget)cli_bcapi_map_getvalue, 440 (cli_apicall_bufget)cli_bcapi_pdf_getobj 441 }; 442 const cli_apicall_int3 cli_apicalls7[] = { 443 (cli_apicall_int3)cli_bcapi_inflate_init, 444 (cli_apicall_int3)cli_bcapi_ipow, 445 (cli_apicall_int3)cli_bcapi_iexp, 446 (cli_apicall_int3)cli_bcapi_isin, 447 (cli_apicall_int3)cli_bcapi_icos, 448 (cli_apicall_int3)cli_bcapi_check_platform 449 }; 450 const cli_apicall_2bufs cli_apicalls8[] = { 451 (cli_apicall_2bufs)cli_bcapi_memstr, 452 (cli_apicall_2bufs)cli_bcapi_version_compare, 453 (cli_apicall_2bufs)cli_bcapi_matchicon 454 }; 455 const cli_apicall_ptrbufid cli_apicalls9[] = { 456 (cli_apicall_ptrbufid)cli_bcapi_map_addkey, 457 (cli_apicall_ptrbufid)cli_bcapi_map_setvalue, 458 (cli_apicall_ptrbufid)cli_bcapi_map_remove, 459 (cli_apicall_ptrbufid)cli_bcapi_map_find, 460 (cli_apicall_ptrbufid)cli_bcapi_file_find_limit, 461 (cli_apicall_ptrbufid)cli_bcapi_disable_bytecode_if, 462 (cli_apicall_ptrbufid)cli_bcapi_disable_jit_if, 463 (cli_apicall_ptrbufid)cli_bcapi_json_get_object, 464 (cli_apicall_ptrbufid)cli_bcapi_json_get_string 465 }; 466 const unsigned cli_apicall_maxapi = sizeof(cli_apicalls)/sizeof(cli_apicalls[0]); 467