Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
Chromium
ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
static int32_t Pnacl_M23_PPB_UDPSocket_Private_SetSocketFeature( PP_Resource udp_socket, PP_UDPSocketFeature_Private name, struct PP_Var *value) { const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface; return iface->SetSocketFeature(udp_socket, name, *...
[ 0, 0 ]
Chromium
ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
static PP_Bool Pnacl_M23_PPB_UDPSocket_Private_GetBoundAddress( PP_Resource udp_socket, struct PP_NetAddress_Private *addr) { const struct PPB_UDPSocket_Private_0_4 *iface = Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4.real_iface; return iface->GetBoundAddress(udp_socket, addr); }
[ 0, 0 ]
Chromium
ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
static int32_t Pnacl_M23_PPB_UDPSocket_Private_SendTo(PP_Resource udp_socket, const char *buffer, int32_t num_bytes, const struct PP_NetAddress_Private *addr, struct PP_CompletionCallback *callback) { ...
[ 0, 0 ]
Chromium
ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
static PP_Bool Pnacl_M19_PPB_X509Certificate_Private_Initialize( PP_Resource resource, const char *bytes, uint32_t length) { const struct PPB_X509Certificate_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1.real_iface; return iface->Initialize(resource, bytes, length); }
[ 0, 0 ]
Chromium
ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
static struct PP_Var Pnacl_M18_PPP_Instance_Private_GetInstanceObject(PP_Instance instance) { const struct PPP_Instance_Private_0_1 *iface = Pnacl_WrapperInfo_PPP_Instance_Private_0_1.real_iface; void (*temp_fp)(struct PP_Var* _struct_result, PP_Instance instance) = ((void (*)(struct PP_Var* _struct_resul...
[ 0, 0 ]
Chromium
ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
static struct __PnaclWrapperInfo *PnaclPPPShimIface(const char *name) { struct __PnaclWrapperInfo **next = s_ppp_wrappers; while (*next != NULL) { if (mystrcmp(name, (*next)->iface_macro) == 0) return *next; ++next; } return NULL; }
[ 0, 0 ]
Chromium
ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
const void *__Pnacl_PPBGetInterface(const char *name) { struct __PnaclWrapperInfo *wrapper = PnaclPPBShimIface(name); if (wrapper == NULL) { return (*__real_PPBGetInterface)(name); } /* Initialize the real_iface if it hasn't been. The wrapper depends on it. */ if (wrapper->real_iface == NULL) { cons...
[ 0, 0 ]
Chromium
ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/test_runner_ppapi.c
static void PppInstanceDidChangeView(PP_Instance instance, PP_Resource view) {}
[ 0, 0 ]
Chromium
ppapi/native_client/tests/nacl_browser/inbrowser_test_runner/test_runner_ppapi.c
static void PppMessagingHandleMessage(PP_Instance instance, struct PP_Var message) { const char *data; uint32_t len; static const char kStartMessage[] = "run_tests"; int num_fails; struct PP_Var result; data = g_browser_var->VarToUtf8(message, &len); if (len == 0) { ...
[ 0, 0 ]
Chromium
ppapi/tests/pp_thread.h
PP_INLINE void PP_JoinThread(PP_Thread thread) { ::WaitForSingleObject(thread.handle, INFINITE); ::CloseHandle(thread.handle); } #endif
[ 0, 0 ]
Chromium
ppapi/tests/test_case.h
void set_callback_type(CallbackType callback_type) { callback_type_ = callback_type; }
[ 0, 0 ]
Chromium
ppapi/tests/test_utils.h
template <typename OutputT> void DeleteStorage(void *user_data, int32_t flags) { typename pp::CompletionCallbackWithOutput<OutputT>::OutputStorageType *storage = reinterpret_cast<typename pp::CompletionCallbackWithOutput< OutputT>::OutputStorageType *>(user_data); delete storage; }
[ 1, 0 ]
Chromium
sandbox/linux/suid/sandbox.c
static void WaitForChildAndExit(pid_t child_pid) { int exit_code = -1; siginfo_t reaped_child_info; // when things are hanging. // Here, the current process is going to waitid() and _exit(), so there is no // point in generating a crash report. The child process is the one // blocking us. if (signal(SIGA...
[ 1, 0 ]
Chromium
sandbox/linux/suid/sandbox.c
static bool SetupChildEnvironment() { unsigned i; // However, the child process might need them so zygote_host_impl_linux.cc // saves a copy in SANDBOX_$x. This is safe because we have dropped root by // this point, so we can only exec a binary with the permissions of the user // who ran us in the first plac...
[ 1, 0 ]
Chromium
sandbox/win/src/crosscall_client.h
ArgType GetType() { return Base::GetType(); }
[ 0, 0 ]
Chromium
sandbox/win/src/crosscall_client.h
template <typename IPCProvider, typename Par1> ResultCode CrossCall(IPCProvider &ipc_provider, IpcTag tag, const Par1 &p1, CrossCallReturn *answer) { XCALL_GEN_PARAMS_OBJ(1, call_params); XCALL_GEN_COPY_PARAM(1, call_params); ResultCode result = ipc_provider.DoCall(call_params, answer); i...
[ 0, 0 ]
Chromium
sandbox/win/src/crosscall_client.h
template <typename IPCProvider, typename Par1, typename Par2, typename Par3> ResultCode CrossCall(IPCProvider &ipc_provider, IpcTag tag, const Par1 &p1, const Par2 &p2, const Par3 &p3, CrossCallReturn *answer) { XCALL_GEN_PARAMS_OBJ(3, call_params); XCALL_GEN_COPY_PARAM(1, call_params); XCALL...
[ 0, 0 ]
Chromium
sandbox/win/src/crosscall_client.h
template <typename IPCProvider, typename Par1, typename Par2, typename Par3, typename Par4> ResultCode CrossCall(IPCProvider &ipc_provider, IpcTag tag, const Par1 &p1, const Par2 &p2, const Par3 &p3, const Par4 &p4, CrossCallReturn *answer) { XCALL_GEN_PARAMS_OBJ(4,...
[ 0, 0 ]
Chromium
sandbox/win/src/crosscall_params.h
void *GetParamPtr(size_t index) { return reinterpret_cast<char *>(this) + param_info_[index].offset_; }
[ 0, 0 ]
Chromium
services/network/public/cpp/url_request_mojom_traits.h
static bool contains_sensitive_info(const scoped_refptr<network::ResourceRequestBody> &r) { return r->contains_sensitive_info_; }
[ 0, 0 ]
Chromium
services/viz/public/cpp/compositing/quads_mojom_traits.h
static bool needs_blending(const DrawQuadWithSharedQuadState &input) { return input.quad->needs_blending; }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/inlined_vector.h
reference operator[](size_type i) { ABSL_HARDENING_ASSERT(i < size()); return data()[i]; }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/inlined_vector.h
reference back() { ABSL_HARDENING_ASSERT(!empty()); return data()[size() - 1]; }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/inlined_vector.h
template <typename ForwardIterator, EnableIfAtLeastForwardIterator<ForwardIterator> * = nullptr> iterator insert(const_iterator pos, ForwardIterator first, ForwardIterator last) { ABSL_HARDENING_ASSERT(pos >= begin()); ABSL_HARDENING_ASSERT(pos <= end()); if (ABSL_PREDICT_TRUE(first != ...
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/inlined_vector.h
void push_back(RValueReference v) { static_cast<void>(emplace_back(std::move(v))); }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/inlined_vector.h
void shrink_to_fit() { if (storage_.GetIsAllocated()) { storage_.ShrinkToFit(); } }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/btree_container.h
template < typename T, typename absl::enable_if_t< absl::conjunction< std::is_same<value_type, typename T::value_type>, std::is_same<allocator_type, typename T::allocator_type>, std::is_same<typename params_type::is_map_container, typename T::...
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h
inline HashtablezInfoHandle Sample() { #if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE) if (ABSL_PREDICT_TRUE(--global_next_sample > 0)) { return HashtablezInfoHandle(nullptr); } return HashtablezInfoHandle(SampleSlow(&global_next_sample)); #else return HashtablezInfoHandle(nullptr); #endif }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
void erase(const_iterator cit) { erase(cit.inner_); }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
void erase(iterator it) { AssertIsFull(it.ctrl_); PolicyTraits::destroy(&alloc_ref(), it.slot_); erase_meta_only(it); }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
iterator erase(const_iterator first, const_iterator last) { while (first != last) { erase(first++); } return last.inner_; }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
node_type extract(const_iterator position) { AssertIsFull(position.inner_.ctrl_); auto node = CommonAccess::Transfer<node_type>(alloc_ref(), position.inner_.slot_); erase_meta_only(position); return node; }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
void swap(raw_hash_set& that) noexcept( IsNoThrowSwappable<hasher>() && IsNoThrowSwappable<key_equal>() && IsNoThrowSwappable<allocator_type>( typename AllocTraits::propagate_on_container_swap{}
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
void rehash(size_t n) { if (n == 0 && capacity_ == 0) return; if (n == 0 && size_ == 0) { destroy_slots(); infoz_.RecordStorageChanged(0, 0); return; } // power-of-2-minus-1, so bitor is good enough. auto m = NormalizeCapacity(n | GrowthToLowerboundCapacity(size())); // n == 0 unconditional...
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
void max_load_factor(float) {}
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
friend void swap(raw_hash_set& a, raw_hash_set& b) noexcept(noexcept(a.swap(b)
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
void reset_growth_left() { growth_left() = CapacityToGrowth(capacity()) - size_; }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
size_t &growth_left() { return settings_.template get<0>(); }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
size_t AllocatedByteSize(const Set &c) { size_t capacity = c.capacity_; if (capacity == 0) return 0; auto layout = Set::MakeLayout(capacity); size_t m = layout.AllocSize(); size_t per_slot = Traits::space_used(static_cast<const Slot *>(nullptr)); if (per_slot != ~size_t{}) { m += per_slot * c.size...
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
size_t LowerBoundAllocatedByteSize(size_t size) { size_t capacity = GrowthToLowerboundCapacity(size); if (capacity == 0) return 0; auto layout = Set::MakeLayout(NormalizeCapacity(capacity)); size_t m = layout.AllocSize(); size_t per_slot = Traits::space_used(static_cast<const Slot *>(nullptr)); if (per...
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/numeric/int128.h
inline uint128 operator&(uint128 lhs, uint128 rhs) {
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/numeric/int128.h
inline uint128 operator^(uint128 lhs, uint128 rhs) { return MakeUint128(Uint128High64(lhs) ^ Uint128High64(rhs), Uint128Low64(lhs) ^ Uint128Low64(rhs)); }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/numeric/int128.h
uint128 operator*(uint128 lhs, uint128 rhs) { #if defined(ABSL_HAVE_INTRINSIC_INT128) // TODO(strel) Remove once alignment issues are resolved and unsigned __int128 // can be used for uint128 storage. return static_cast<unsigned __int128>(lhs) * static_cast<unsigned __int128>(rhs); #elif defined(_MSC_VER...
[ 1, 1 ]
Chromium
third_party/abseil-cpp/absl/numeric/int128.h
constexpr int128 MakeInt128(int64_t high, uint64_t low) { return int128(high, low); }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/strings/cord.h
CharIterator char_end() const;
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h
constexpr uint64_t FormatConversionCharToConvInt(FormatConversionChar c) { return uint64_t{1} << (1 + static_cast<uint8_t>(c)); }
[ 1, 0 ]
Chromium
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h
constexpr uint64_t FormatConversionCharToConvInt(char conv) { return #define ABSL_INTERNAL_CHAR_SET_CASE(c) \ conv == #c[0] \ ? FormatConversionCharToConvInt(FormatConversionCharInternal::c) \ ...
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h
constexpr FormatConversionCharSet ToFormatConversionCharSet(char c) { return static_cast<FormatConversionCharSet>( FormatConversionCharToConvValue(c)); }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h
constexpr bool Contains(FormatConversionCharSet set, FormatConversionCharSet c) { return (static_cast<uint64_t>(set) & static_cast<uint64_t>(c)) == static_cast<uint64_t>(c); }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h
constexpr bool Contains(FormatConversionCharSet set, FormatConversionChar c) { return (static_cast<uint64_t>(set) & FormatConversionCharToConvInt(c)) != 0; }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/types/internal/conformance_profile.h
template <class T, class MinProf, class MaxProf> void ExpectModelOfSwappable(ConformanceErrors *errors) { (ExpectModelOfImpl)(errors, PropertiesOfT<MinProf>::swappable_support, PropertiesOfT<MaxProf>::swappable_support, swappable_support_of<T>()); }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/types/internal/conformance_profile.h
The necessary support-checking and error-reporting functions for std::hash. template <class T> constexpr hashable hashable_support_of() { return type_traits_internal::IsHashable<T>::value ? hashable::yes : hashable::maybe; }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/types/internal/conformance_profile.h
template <class H> constexpr H MinEnum(H head) { return head; }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/types/variant.h
Checks whether the given variant currently holds a given alternative type, returning `true` if so. Example : absl::variant<int, std::string> foo = 42; if (absl::holds_alternative<int>(foo)) { std::cout << "The variant holds an integer"; } template <class T, class... Types> constexpr bool holds_a...
[ 1, 0 ]
Chromium
third_party/abseil-cpp/absl/types/variant.h
template <std::size_t I, class... Types> constexpr variant_alternative_t<I, variant<Types...>> & get(variant<Types...> &v) { return variant_internal::VariantCoreAccess::CheckedAccess<I>(v); }
[ 0, 0 ]
Chromium
third_party/abseil-cpp/absl/types/variant.h
template <std::size_t I, class... Types> constexpr const variant_alternative_t<I, variant<Types...>> & get(const variant<Types...> &v) { return variant_internal::VariantCoreAccess::CheckedAccess<I>(v); }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-analyze.c
static inline u8 anything_set(void) { u32 *ptr = (u32 *)trace_bits; u32 i = (MAP_SIZE >> 2); while (i--) if (*(ptr++)) return 1; return 0; }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-analyze.c
static void handle_stop_sig(int sig) { stop_soon = 1; if (child_pid > 0) kill(child_pid, SIGKILL); }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-analyze.c
static char **get_qemu_argv(u8 *own_loc, char **argv, int argc) { char **new_argv = ck_alloc(sizeof(char *) * (argc + 4)); u8 *tmp, *cp, *rsl, *own_copy; setenv("QEMU_LOG", "nochain", 1); memcpy(new_argv + 3, argv + 1, sizeof(char *) * argc); /* Now we need to actually find qemu for argv[0]. */ new_arg...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static inline u32 UR(u32 limit) { if (unlikely(!rand_cnt--)) { u32 seed[2]; ck_read(dev_urandom_fd, &seed, sizeof(seed), "/dev/urandom"); srandom(seed[0]); rand_cnt = (RESEED_RNG / 2) + (seed[1] % RESEED_RNG); } return random() % limit; }
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void mark_as_det_done(struct queue_entry *q) { u8 *fn = strrchr(q->fname, '/'); s32 fd; fn = alloc_printf("%s/queue/.state/deterministic_done/%s", out_dir, fn + 1); fd = open(fn, O_WRONLY | O_CREAT | O_EXCL, 0600); if (fd < 0) PFATAL("Unable to create '%s'", fn); close(fd); ck_free(fn); ...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
EXP_ST void write_bitmap(void) { u8 *fname; s32 fd; if (!bitmap_changed) return; bitmap_changed = 0; fname = alloc_printf("%s/fuzz_bitmap", out_dir); fd = open(fname, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd < 0) PFATAL("Unable to open '%s'", fname); ck_write(fd, virgin_bits, MAP_SIZE, f...
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static u32 count_bytes(u8 *mem) { u32 *ptr = (u32 *)mem; u32 i = (MAP_SIZE >> 2); u32 ret = 0; while (i--) { u32 v = *(ptr++); if (!v) continue; if (v & FF(0)) ret++; if (v & FF(1)) ret++; if (v & FF(2)) ret++; if (v & FF(3)) ret++; } return ret; }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void simplify_trace(u64 *mem) { u32 i = MAP_SIZE >> 3; while (i--) { if (unlikely(*mem)) { u8 *mem8 = (u8 *)mem; mem8[0] = simplify_lookup[mem8[0]]; mem8[1] = simplify_lookup[mem8[1]]; mem8[2] = simplify_lookup[mem8[2]]; mem8[3] = simplify_lookup[mem8[3]]; mem8[4]...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
EXP_ST void init_count_class16(void) { u32 b1, b2; for (b1 = 0; b1 < 256; b1++) for (b2 = 0; b2 < 256; b2++) count_class_lookup16[(b1 << 8) + b2] = (count_class_lookup8[b1] << 8) | count_class_lookup8[b2]; } #ifdef __x86_64__
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static inline void classify_counts(u64 *mem) { u32 i = MAP_SIZE >> 3; while (i--) { if (unlikely(*mem)) { u16 *mem16 = (u16 *)mem; mem16[0] = count_class_lookup16[mem16[0]]; mem16[1] = count_class_lookup16[mem16[1]]; mem16[2] = count_class_lookup16[mem16[2]]; mem16[3] = count_...
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void cull_queue(void) { struct queue_entry *q; static u8 temp_v[MAP_SIZE >> 3]; u32 i; if (dumb_mode || !score_changed) return; score_changed = 0; memset(temp_v, 255, MAP_SIZE >> 3); queued_favored = 0; pending_favored = 0; q = queue; while (q) { q->favored = 0; q = q->next...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
EXP_ST void setup_shm(void) { u8 *shm_str; if (!in_bitmap) memset(virgin_bits, 255, MAP_SIZE); memset(virgin_tmout, 255, MAP_SIZE); memset(virgin_crash, 255, MAP_SIZE); shm_id = shmget(IPC_PRIVATE, MAP_SIZE, IPC_CREAT | IPC_EXCL | 0600); if (shm_id < 0) PFATAL("shmget() failed"); atexit(remo...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void setup_post(void) { void *dh; u8 *fn = getenv("AFL_POST_LIBRARY"); u32 tlen = 6; if (!fn) return; ACTF("Loading postprocessor from '%s'...", fn); dh = dlopen(fn, RTLD_NOW); if (!dh) FATAL("%s", dlerror()); post_handler = dlsym(dh, "afl_postprocess"); if (!post_handler) FATA...
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static int compare_extras_len(const void *p1, const void *p2) { struct extra_data *e1 = (struct extra_data *)p1, *e2 = (struct extra_data *)p2; return e1->len - e2->len; }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static int compare_extras_use_d(const void *p1, const void *p2) { struct extra_data *e1 = (struct extra_data *)p1, *e2 = (struct extra_data *)p2; return e2->hit_cnt - e1->hit_cnt; }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void write_to_testcase(void *mem, u32 len) { s32 fd = out_fd; if (out_file) { unlink(out_file); fd = open(out_file, O_WRONLY | O_CREAT | O_EXCL, 0600); if (fd < 0) PFATAL("Unable to create '%s'", out_file); } else lseek(fd, 0, SEEK_SET); ck_write(fd, mem, len, out_file); i...
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void write_crash_readme(void) { u8 *fn = alloc_printf("%s/crashes/README.txt", out_dir); s32 fd; FILE *f; fd = open(fn, O_WRONLY | O_CREAT | O_EXCL, 0600); ck_free(fn); if (fd < 0) return; f = fdopen(fd, "w"); if (!f) { close(fd); return; } fprintf( f, "Command l...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static u32 find_start_position(void) { static u8 tmp[4096]; u8 *fn, *off; s32 fd, i; u32 ret; if (!resuming_fuzz) return 0; if (in_place_resume) fn = alloc_printf("%s/fuzzer_stats", out_dir); else fn = alloc_printf("%s/../fuzzer_stats", in_dir); fd = open(fn, O_RDONLY); ck_free(fn); ...
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static u8 could_be_bitflip(u32 xor_val) { u32 sh = 0; if (!xor_val) return 1; while (!(xor_val & 1)) { sh++; xor_val >>= 1; } /* 1-, 2-, and 4-bit patterns are OK anywhere. */ if (xor_val == 1 || xor_val == 3 || xor_val == 15) return 1; /* 8-, 16-, and 32-bit patterns are OK only if ...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static u8 could_be_interest(u32 old_val, u32 new_val, u8 blen, u8 check_le) { u32 i, j; if (old_val == new_val) return 1; for (i = 0; i < blen; i++) { for (j = 0; j < sizeof(interesting_8); j++) { u32 tval = (old_val & ~(0xff << (i * 8))) | (((u8)interesting_8[j]) << (i * 8)); ...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void handle_skipreq(int sig) { skip_requested = 1; }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void check_if_tty(void) { struct winsize ws; if (getenv("AFL_NO_UI")) { OKF("Disabling the UI because AFL_NO_UI is set."); not_on_tty = 1; return; } if (ioctl(1, TIOCGWINSZ, &ws)) { if (errno == ENOTTY) { OKF("Looks like we're not running on a tty, so I'll be a bit less " ...
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void fix_up_sync(void) { u8 *x = sync_id; if (dumb_mode) FATAL("-S / -M and -n are mutually exclusive"); if (skip_deterministic) { if (force_deterministic) FATAL("use -S instead of -M -d"); else FATAL("-S already implies -d"); } while (*x) { if (!isalnum(*x) && *x != '...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void check_asan_opts(void) { u8 *x = getenv("ASAN_OPTIONS"); if (x) { if (!strstr(x, "abort_on_error=1")) FATAL("Custom ASAN_OPTIONS set without abort_on_error=1 - please fix!"); if (!strstr(x, "symbolize=0")) FATAL("Custom ASAN_OPTIONS set without symbolize=0 - please fix!"); } x...
[ 0, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
EXP_ST void detect_file_args(char **argv) { u32 i = 0; u8 *cwd = getcwd(NULL, 0); if (!cwd) PFATAL("getcwd() failed"); while (argv[i]) { u8 *aa_loc = strstr(argv[i], "@@"); if (aa_loc) { u8 *aa_subst, *n_arg; if (!out_file) out_file = alloc_printf("%s/.cur_input", out_dir)...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-fuzz.c
static void save_cmdline(u32 argc, char **argv) { u32 len = 1, i; u8 *buf; for (i = 0; i < argc; i++) len += strlen(argv[i]) + 1; buf = orig_cmdline = ck_alloc(len); for (i = 0; i < argc; i++) { u32 l = strlen(argv[i]); memcpy(buf, argv[i], l); buf += l; if (i != argc - 1) *(b...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-gcc.c
int main(int argc, char **argv) { if (isatty(2) && !getenv("AFL_QUIET")) { SAYF(cCYA "afl-cc " cBRI VERSION cRST " by <lcamtuf@google.com>\n"); } else be_quiet = 1; if (argc < 2) { SAYF("\n" "This is a helper application for afl-fuzz. It serves as a drop-in " "replacement\n" ...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-gotcpu.c
static u32 measure_preemption(u32 target_ms) { static volatile u32 v1, v2; u64 st_t, en_t, st_c, en_c, real_delta, slice_delta; s32 loop_repeats = 0; st_t = get_cur_time_us(); st_c = get_cpu_usage_us(); repeat_loop: v1 = CTEST_BUSY_CYCLES; while (v1--) v2++; sched_yield(); en_t = get_cur_ti...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-showmap.c
static void remove_shm(void) { shmctl(shm_id, IPC_RMID, NULL); }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-showmap.c
static void handle_timeout(int sig) { child_timed_out = 1; if (child_pid > 0) kill(child_pid, SIGKILL); }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-showmap.c
static void show_banner(void) { SAYF(cCYA "afl-showmap " cBRI VERSION cRST " by <lcamtuf@google.com>\n"); }
[ 1, 0 ]
Chromium
third_party/afl/src/afl-showmap.c
static void find_binary(u8 *fname) { u8 *env_path = 0; struct stat st; if (strchr(fname, '/') || !(env_path = getenv("PATH"))) { target_path = ck_strdup(fname); if (stat(target_path, &st) || !S_ISREG(st.st_mode) || !(st.st_mode & 0111) || st.st_size < 4) FATAL("Program '%s' not found or ...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-showmap.c
static char **get_qemu_argv(u8 *own_loc, char **argv, int argc) { char **new_argv = ck_alloc(sizeof(char *) * (argc + 4)); u8 *tmp, *cp, *rsl, *own_copy; setenv("QEMU_LOG", "nochain", 1); memcpy(new_argv + 3, argv + 1, sizeof(char *) * argc); new_argv[2] = target_path; new_argv[1] = "--"; /* Now we n...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-tmin.c
static inline u8 anything_set(void) { u32 *ptr = (u32 *)trace_bits; u32 i = (MAP_SIZE >> 2); while (i--) if (*(ptr++)) return 1; return 0; }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-tmin.c
static void read_initial_file(void) { struct stat st; s32 fd = open(in_file, O_RDONLY); if (fd < 0) PFATAL("Unable to open '%s'", in_file); if (fstat(fd, &st) || !st.st_size) FATAL("Zero-sized input file."); if (st.st_size >= TMIN_MAX_FILE) FATAL("Input file is too large (%u MB max)", TMIN_MAX...
[ 1, 0 ]
Chromium
third_party/afl/src/afl-tmin.c
static void handle_timeout(int sig) { child_timed_out = 1; if (child_pid > 0) kill(child_pid, SIGKILL); }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-tmin.c
static u32 next_p2(u32 val) { u32 ret = 1; while (val > ret) ret <<= 1; return ret; }
[ 1, 0 ]
Chromium
third_party/afl/src/afl-tmin.c
static void handle_stop_sig(int sig) { stop_soon = 1; if (child_pid > 0) kill(child_pid, SIGKILL); }
[ 0, 0 ]
Chromium
third_party/afl/src/afl-tmin.c
static void read_bitmap(u8 *fname) { s32 fd = open(fname, O_RDONLY); if (fd < 0) PFATAL("Unable to open '%s'", fname); ck_read(fd, mask_bitmap, MAP_SIZE, fname); close(fd); }
[ 0, 0 ]
Chromium
third_party/afl/src/alloc-inl.h
static inline void *DFL_ck_alloc_nozero(u32 size) { void *ret; if (!size) return NULL; ALLOC_CHECK_SIZE(size); ret = malloc(size + ALLOC_OFF_TOTAL); ALLOC_CHECK_RESULT(ret, size); ret += ALLOC_OFF_HEAD; ALLOC_C1(ret) = ALLOC_MAGIC_C1; ALLOC_S(ret) = size; ALLOC_C2(ret) = ALLOC_MAGIC_C2; re...
[ 1, 0 ]
Chromium
third_party/afl/src/alloc-inl.h
static inline void *DFL_ck_realloc_block(void *orig, u32 size) { #ifndef DEBUG_BUILD if (orig) { CHECK_PTR(orig); if (ALLOC_S(orig) >= size) return orig; size += ALLOC_BLK_INC; } #endif return DFL_ck_realloc(orig, size); }
[ 0, 0 ]
Chromium
third_party/afl/src/alloc-inl.h
static inline void TRK_alloc_buf(void *ptr, const char *file, const char *func, u32 line) { u32 i, bucket; if (!ptr) return; bucket = TRKH(ptr); for (i = 0; i < TRK_cnt[bucket]; i++) if (!TRK[bucket][i].ptr) { TRK[bucket][i].ptr = ptr; TRK[bucket][i].fi...
[ 1, 0 ]
Chromium
third_party/afl/src/alloc-inl.h
static inline void *TRK_ck_alloc(u32 size, const char *file, const char *func, u32 line) { void *ret = DFL_ck_alloc(size); TRK_alloc_buf(ret, file, func, line); return ret; }
[ 0, 0 ]
Chromium
third_party/afl/src/alloc-inl.h
static inline void *TRK_ck_memdup(void *mem, u32 size, const char *file, const char *func, u32 line) { void *ret = DFL_ck_memdup(mem, size); TRK_alloc_buf(ret, file, func, line); return ret; }
[ 0, 0 ]