• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2016-2020, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under both the BSD-style license (found in the
6  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7  * in the COPYING file in the root directory of this source tree).
8  * You may select, at your option, one of the above-listed licenses.
9  */
10 #include "fuzz_helpers.h"
11 
12 #include <stddef.h>
13 #include <stdlib.h>
14 #include <string.h>
15 
FUZZ_malloc(size_t size)16 void* FUZZ_malloc(size_t size)
17 {
18     if (size > 0) {
19         void* const mem = malloc(size);
20         FUZZ_ASSERT(mem);
21         return mem;
22     }
23     return NULL;
24 }
25 
FUZZ_memcmp(void const * lhs,void const * rhs,size_t size)26 int FUZZ_memcmp(void const* lhs, void const* rhs, size_t size)
27 {
28     if (size == 0) {
29         return 0;
30     }
31     return memcmp(lhs, rhs, size);
32 }