mirror of
https://github.com/DaveGamble/cJSON.git
synced 2026-11-14 19:03:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7aed06e364 | ||
|
|
33865a75a1 | ||
|
|
6d3a32122e | ||
|
|
ed549df6e7 | ||
|
|
7aa668ee7a | ||
|
|
7f8ee7084a | ||
|
|
5f1fdb4c6f | ||
|
|
9189b3322a | ||
|
|
bfbd8fe0d8 | ||
|
|
82295f9e4f | ||
|
|
38b44a298d | ||
|
|
00d5e225a6 | ||
|
|
9ecc96878f | ||
|
|
3efee9fda8 | ||
|
|
71a7b64860 | ||
|
|
ddf268b074 |
No files matched your search
@@ -1,3 +1,19 @@
|
|||||||
|
1.5.4
|
||||||
|
=====
|
||||||
|
Fixes:
|
||||||
|
------
|
||||||
|
* Fix build with GCC 7.1.1 and optimization level `-O2` (bfbd8fe0d85f1dd21e508748fc10fc4c27cc51be)
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
--------------
|
||||||
|
* Update [Unity](https://github.com/ThrowTheSwitch/Unity) to 3b69beaa58efc41bbbef70a32a46893cae02719d
|
||||||
|
|
||||||
|
1.5.3
|
||||||
|
=====
|
||||||
|
Fixes:
|
||||||
|
------
|
||||||
|
* Fix `cJSON_ReplaceItemInObject` not keeping the name of an item (#174)
|
||||||
|
|
||||||
1.5.2
|
1.5.2
|
||||||
=====
|
=====
|
||||||
Fixes:
|
Fixes:
|
||||||
|
|||||||
+6
-1
@@ -7,7 +7,7 @@ project(cJSON C)
|
|||||||
|
|
||||||
set(PROJECT_VERSION_MAJOR 1)
|
set(PROJECT_VERSION_MAJOR 1)
|
||||||
set(PROJECT_VERSION_MINOR 5)
|
set(PROJECT_VERSION_MINOR 5)
|
||||||
set(PROJECT_VERSION_PATCH 2)
|
set(PROJECT_VERSION_PATCH 4)
|
||||||
set(CJSON_VERSION_SO 1)
|
set(CJSON_VERSION_SO 1)
|
||||||
set(CJSON_UTILS_VERSION_SO 1)
|
set(CJSON_UTILS_VERSION_SO 1)
|
||||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||||
@@ -41,6 +41,11 @@ if (ENABLE_CUSTOM_COMPILER_FLAGS)
|
|||||||
-Wcomma
|
-Wcomma
|
||||||
-Wdouble-promotion
|
-Wdouble-promotion
|
||||||
-Wparentheses
|
-Wparentheses
|
||||||
|
-Wformat-overflow
|
||||||
|
-Wunused-macros
|
||||||
|
-Wmissing-variable-declarations
|
||||||
|
-Wused-but-marked-unused
|
||||||
|
-Wswitch-enum
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ Contributors
|
|||||||
* [Dave Gamble](https://github.com/DaveGamble)
|
* [Dave Gamble](https://github.com/DaveGamble)
|
||||||
* [Debora Grosse](https://github.com/DeboraG)
|
* [Debora Grosse](https://github.com/DeboraG)
|
||||||
* [dieyushi](https://github.com/dieyushi)
|
* [dieyushi](https://github.com/dieyushi)
|
||||||
* [Dongwen Huang (黄东文)](https://github.com/DongwenHuang)
|
* [Dōngwén Huáng (黄东文)](https://github.com/DongwenHuang)
|
||||||
* Eswar Yaganti
|
* Eswar Yaganti
|
||||||
* [Evan Todd](https://github.com/etodd)
|
* [Evan Todd](https://github.com/etodd)
|
||||||
* [Fabrice Fontaine](https://github.com/ffontaine)
|
* [Fabrice Fontaine](https://github.com/ffontaine)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ CJSON_TEST_SRC = cJSON.c test.c
|
|||||||
|
|
||||||
LDLIBS = -lm
|
LDLIBS = -lm
|
||||||
|
|
||||||
LIBVERSION = 1.5.2
|
LIBVERSION = 1.5.4
|
||||||
CJSON_SOVERSION = 1
|
CJSON_SOVERSION = 1
|
||||||
UTILS_SOVERSION = 1
|
UTILS_SOVERSION = 1
|
||||||
|
|
||||||
|
|||||||
@@ -383,17 +383,17 @@ cJSON doesn't support strings that contain the zero character `'\0'` or `\u0000`
|
|||||||
|
|
||||||
#### Character Encoding
|
#### Character Encoding
|
||||||
|
|
||||||
cJSON only supports UTF-8 encoded input and will always produce UTF-8 as output (If the input contained invalid UTF-8, it will most likely propagate it through to the output, thereby making the output non-valid UTF-8).
|
cJSON only supports UTF-8 encoded input. In most cases it doesn't reject invalid UTF-8 as input though, it just propagates it through as is. As long as the input doesn't contain invalid UTF-8, the output will always be valid UTF-8.
|
||||||
|
|
||||||
#### C Standard
|
#### C Standard
|
||||||
|
|
||||||
cJSON is written in ANSI C (or C89, C90). If your compiler or C library doesn't follow this standard, correct behavior is not guaranteed.
|
cJSON is written in ANSI C (or C89, C90). If your compiler or C library doesn't follow this standard, correct behavior is not guaranteed.
|
||||||
|
|
||||||
NOTE: ANSI C is not C++ therefore it shouldn't be compiled by a C++ compiler. You can compile it with a C compiler and link it with your C++ code however. Although compiling with a C++ compiler might work, correct behavior is not guaranteed.
|
NOTE: ANSI C is not C++ therefore it shouldn't be compiled with a C++ compiler. You can compile it with a C compiler and link it with your C++ code however. Although compiling with a C++ compiler might work, correct behavior is not guaranteed.
|
||||||
|
|
||||||
#### Floating Point Numbers
|
#### Floating Point Numbers
|
||||||
|
|
||||||
cJSON does not officially support any `double` implementations other than IEE754 double precision floating point numbers. It might still work with other implementations but bugs with these will be considered invalid.
|
cJSON does not officially support any `double` implementations other than IEEE754 double precision floating point numbers. It might still work with other implementations but bugs with these will be considered invalid.
|
||||||
|
|
||||||
The maximum length of a floating point literal that cJSON supports is currently 63 characters.
|
The maximum length of a floating point literal that cJSON supports is currently 63 characters.
|
||||||
|
|
||||||
@@ -417,3 +417,4 @@ When cJSON was originally created, it didn't follow the JSON standard and didn't
|
|||||||
# Enjoy cJSON!
|
# Enjoy cJSON!
|
||||||
|
|
||||||
- Dave Gamble, Aug 2009
|
- Dave Gamble, Aug 2009
|
||||||
|
- [cJSON contributors](CONTRIBUTORS.md)
|
||||||
@@ -58,7 +58,7 @@ CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */
|
/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */
|
||||||
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 5) || (CJSON_VERSION_PATCH != 2)
|
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 5) || (CJSON_VERSION_PATCH != 4)
|
||||||
#error cJSON.h and cJSON.c have different versions. Make sure that both have the same.
|
#error cJSON.h and cJSON.c have different versions. Make sure that both have the same.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -208,7 +208,6 @@ typedef struct
|
|||||||
|
|
||||||
/* check if the given size is left to read in a given parse buffer (starting with 1) */
|
/* check if the given size is left to read in a given parse buffer (starting with 1) */
|
||||||
#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length))
|
#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length))
|
||||||
#define cannot_read(buffer, size) (!can_read(buffer, size))
|
|
||||||
/* check if the buffer can be accessed at the given index (starting with 0) */
|
/* check if the buffer can be accessed at the given index (starting with 0) */
|
||||||
#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
|
#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
|
||||||
#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
|
#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
|
||||||
@@ -1975,14 +1974,34 @@ CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newi
|
|||||||
cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem);
|
cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive)
|
||||||
|
{
|
||||||
|
if (replacement == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* replace the name in the replacement */
|
||||||
|
if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL))
|
||||||
|
{
|
||||||
|
cJSON_free(replacement->string);
|
||||||
|
}
|
||||||
|
replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
|
||||||
|
replacement->type &= ~cJSON_StringIsConst;
|
||||||
|
|
||||||
|
cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem)
|
CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem)
|
||||||
{
|
{
|
||||||
cJSON_ReplaceItemViaPointer(object, cJSON_GetObjectItem(object, string), newitem);
|
replace_item_in_object(object, string, newitem, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem)
|
CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem)
|
||||||
{
|
{
|
||||||
cJSON_ReplaceItemViaPointer(object, cJSON_GetObjectItemCaseSensitive(object, string), newitem);
|
replace_item_in_object(object, string, newitem, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create basic types: */
|
/* Create basic types: */
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ extern "C"
|
|||||||
/* project version */
|
/* project version */
|
||||||
#define CJSON_VERSION_MAJOR 1
|
#define CJSON_VERSION_MAJOR 1
|
||||||
#define CJSON_VERSION_MINOR 5
|
#define CJSON_VERSION_MINOR 5
|
||||||
#define CJSON_VERSION_PATCH 2
|
#define CJSON_VERSION_PATCH 4
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
|||||||
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
||||||
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||||
|
|
||||||
/* Macro for iterating over an array */
|
/* Macro for iterating over an array or object */
|
||||||
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||||
|
|
||||||
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
afl-build
|
afl-build
|
||||||
|
libfuzzer-build
|
||||||
+10
-7
@@ -5,23 +5,26 @@ if (ENABLE_FUZZING)
|
|||||||
message(FATAL_ERROR "Couldn't find afl-fuzz.")
|
message(FATAL_ERROR "Couldn't find afl-fuzz.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(ENABLE_LIBFUZZER "Enable fuzzing with libfuzzer (only works with llvm 5 which hasn't been release at this point)" Off)
|
||||||
|
if (ENABLE_LIBFUZZER)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=fuzzer")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(fuzz-target fuzz-target.c)
|
||||||
|
target_link_libraries(fuzz-target "${CJSON_LIB}")
|
||||||
|
|
||||||
add_executable(afl-main afl.c)
|
add_executable(afl-main afl.c)
|
||||||
target_link_libraries(afl-main "${CJSON_LIB}")
|
target_link_libraries(afl-main fuzz-target)
|
||||||
|
|
||||||
if (NOT ENABLE_SANITIZERS)
|
if (NOT ENABLE_SANITIZERS)
|
||||||
message(FATAL_ERROR "Enable sanitizers with -DENABLE_SANITIZERS=On to do fuzzing.")
|
message(FATAL_ERROR "Enable sanitizers with -DENABLE_SANITIZERS=On to do fuzzing.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_FUZZING_PRINT "Fuzz printing functions together with parser." On)
|
|
||||||
set(fuzz_print_parameter "no")
|
|
||||||
if (ENABLE_FUZZING_PRINT)
|
|
||||||
set(fuzz_print_parameter "yes")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error")
|
||||||
|
|
||||||
add_custom_target(afl
|
add_custom_target(afl
|
||||||
COMMAND "${AFL_FUZZ}" -i "${CMAKE_CURRENT_SOURCE_DIR}/inputs" -o "${CMAKE_CURRENT_BINARY_DIR}/findings" -x "${CMAKE_CURRENT_SOURCE_DIR}/json.dict" -- "${CMAKE_CURRENT_BINARY_DIR}/afl-main" "@@" "${fuzz_print_parameter}"
|
COMMAND "${AFL_FUZZ}" -i "${CMAKE_CURRENT_SOURCE_DIR}/inputs" -o "${CMAKE_CURRENT_BINARY_DIR}/findings" -x "${CMAKE_CURRENT_SOURCE_DIR}/json.dict" -- "${CMAKE_CURRENT_BINARY_DIR}/afl-main" "@@"
|
||||||
DEPENDS afl-main)
|
DEPENDS afl-main)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+35
-60
@@ -24,54 +24,71 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../cJSON.h"
|
#include "fuzz-target.h"
|
||||||
|
|
||||||
static char *read_file(const char *filename)
|
static char *read_file(const char *filename, size_t *size)
|
||||||
{
|
{
|
||||||
FILE *file = NULL;
|
FILE *file = NULL;
|
||||||
long length = 0;
|
long length = 0;
|
||||||
char *content = NULL;
|
char *content = NULL;
|
||||||
size_t read_chars = 0;
|
size_t read_chars = 0;
|
||||||
|
|
||||||
|
if (size == NULL)
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
/* open in read binary mode */
|
/* open in read binary mode */
|
||||||
file = fopen(filename, "rb");
|
file = fopen(filename, "rb");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
goto cleanup;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get the length */
|
/* get the length */
|
||||||
if (fseek(file, 0, SEEK_END) != 0)
|
if (fseek(file, 0, SEEK_END) != 0)
|
||||||
{
|
{
|
||||||
goto cleanup;
|
goto fail;
|
||||||
}
|
}
|
||||||
length = ftell(file);
|
length = ftell(file);
|
||||||
if (length < 0)
|
if (length < 0)
|
||||||
{
|
{
|
||||||
goto cleanup;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (fseek(file, 0, SEEK_SET) != 0)
|
if (fseek(file, 0, SEEK_SET) != 0)
|
||||||
{
|
{
|
||||||
goto cleanup;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate content buffer */
|
/* allocate content buffer */
|
||||||
content = (char*)malloc((size_t)length + sizeof(""));
|
content = (char*)malloc((size_t)length + sizeof(""));
|
||||||
if (content == NULL)
|
if (content == NULL)
|
||||||
{
|
{
|
||||||
goto cleanup;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read the file into memory */
|
/* read the file into memory */
|
||||||
read_chars = fread(content, sizeof(char), (size_t)length, file);
|
read_chars = fread(content, sizeof(char), (size_t)length, file);
|
||||||
if ((long)read_chars != length)
|
if ((long)read_chars != length)
|
||||||
{
|
{
|
||||||
free(content);
|
goto fail;
|
||||||
content = NULL;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
content[read_chars] = '\0';
|
content[read_chars] = '\0';
|
||||||
|
|
||||||
|
*size = read_chars + sizeof("");
|
||||||
|
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
if (size != NULL)
|
||||||
|
{
|
||||||
|
*size = 0;
|
||||||
|
}
|
||||||
|
if (content != NULL)
|
||||||
|
{
|
||||||
|
free(content);
|
||||||
|
content = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (file != NULL)
|
if (file != NULL)
|
||||||
@@ -85,79 +102,39 @@ cleanup:
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
const char *filename = NULL;
|
const char *filename = NULL;
|
||||||
cJSON *item = NULL;
|
|
||||||
char *json = NULL;
|
char *json = NULL;
|
||||||
int status = EXIT_FAILURE;
|
int status = EXIT_FAILURE;
|
||||||
char *printed_json = NULL;
|
char *printed_json = NULL;
|
||||||
|
|
||||||
if ((argc < 2) || (argc > 3))
|
if (argc != 2)
|
||||||
{
|
{
|
||||||
printf("Usage:\n");
|
printf("Usage:\n");
|
||||||
printf("%s input_file [enable_printing]\n", argv[0]);
|
printf("%s input_file\n", argv[0]);
|
||||||
printf("\t input_file: file containing the test data\n");
|
printf("\t input_file: file containing the test data\n");
|
||||||
printf("\t enable_printing: print after parsing, 'yes' or 'no', defaults to 'no'\n");
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = argv[1];
|
filename = argv[1];
|
||||||
|
|
||||||
#if __AFL_HAVE_MANUAL_CONTROL
|
#if defined(__AFL_HAVE_MANUAL_CONTROL) && __AFL_HAVE_MANUAL_CONTROL
|
||||||
while (__AFL_LOOP(1000))
|
while (__AFL_LOOP(1000))
|
||||||
{
|
{
|
||||||
|
#else
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
|
size_t size = 0;
|
||||||
status = EXIT_SUCCESS;
|
status = EXIT_SUCCESS;
|
||||||
|
|
||||||
json = read_file(filename);
|
json = read_file(filename, &size);
|
||||||
if ((json == NULL) || (json[0] == '\0') || (json[1] == '\0'))
|
if ((json == NULL) || (json[0] == '\0') || (json[1] == '\0'))
|
||||||
{
|
{
|
||||||
status = EXIT_FAILURE;
|
status = EXIT_FAILURE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
item = cJSON_Parse(json + 2);
|
|
||||||
if (item == NULL)
|
|
||||||
{
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((argc == 3) && (strncmp(argv[2], "yes", 3) == 0))
|
LLVMFuzzerTestOneInput(json, size);
|
||||||
{
|
|
||||||
int do_format = 0;
|
|
||||||
if (json[1] == 'f')
|
|
||||||
{
|
|
||||||
do_format = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (json[0] == 'b')
|
|
||||||
{
|
|
||||||
/* buffered printing */
|
|
||||||
printed_json = cJSON_PrintBuffered(item, 1, do_format);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* unbuffered printing */
|
|
||||||
if (do_format)
|
|
||||||
{
|
|
||||||
printed_json = cJSON_Print(item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printed_json = cJSON_PrintUnformatted(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (printed_json == NULL)
|
|
||||||
{
|
|
||||||
status = EXIT_FAILURE;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
printf("%s\n", printed_json);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (item != NULL)
|
|
||||||
{
|
|
||||||
cJSON_Delete(item);
|
|
||||||
item = NULL;
|
|
||||||
}
|
|
||||||
if (json != NULL)
|
if (json != NULL)
|
||||||
{
|
{
|
||||||
free(json);
|
free(json);
|
||||||
@@ -168,9 +145,7 @@ cleanup:
|
|||||||
free(printed_json);
|
free(printed_json);
|
||||||
printed_json = NULL;
|
printed_json = NULL;
|
||||||
}
|
}
|
||||||
#if __AFL_HAVE_MANUAL_CONTROL
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "fuzz-target.h"
|
||||||
|
#include "../cJSON.h"
|
||||||
|
|
||||||
|
static void minify(const unsigned char *data, size_t size)
|
||||||
|
{
|
||||||
|
unsigned char *copied_data = (unsigned char*)malloc(size);
|
||||||
|
if (copied_data == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(copied_data, data, size);
|
||||||
|
|
||||||
|
cJSON_Minify((char*)copied_data);
|
||||||
|
|
||||||
|
free(copied_data);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void printing(cJSON *json, unsigned char format_setting, unsigned char buffered_setting)
|
||||||
|
{
|
||||||
|
unsigned char *printed = NULL;
|
||||||
|
|
||||||
|
if (buffered_setting == '1')
|
||||||
|
{
|
||||||
|
printed = (unsigned char*)cJSON_PrintBuffered(json, 1, (format_setting == '1'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (format_setting == '1')
|
||||||
|
{
|
||||||
|
printed = (unsigned char*)cJSON_Print(json);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printed = (unsigned char*)cJSON_PrintUnformatted(json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (printed != NULL)
|
||||||
|
{
|
||||||
|
free(printed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size)
|
||||||
|
{
|
||||||
|
unsigned char minify_setting = '\0'; /* minify instead of parsing */
|
||||||
|
unsigned char require_zero_setting = '\0'; /* zero termination required */
|
||||||
|
unsigned char format_setting = '\0'; /* formatted printing */
|
||||||
|
unsigned char buffered_setting = '\0'; /* buffered printing */
|
||||||
|
const size_t data_offset = 4;
|
||||||
|
|
||||||
|
cJSON *json = NULL;
|
||||||
|
|
||||||
|
/* don't work with NULL or without mode selector */
|
||||||
|
if ((data == NULL) || (size < data_offset))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get configuration from the beginning of the test case */
|
||||||
|
minify_setting = data[0];
|
||||||
|
require_zero_setting = data[1];
|
||||||
|
format_setting = data[2];
|
||||||
|
buffered_setting = data[3];
|
||||||
|
|
||||||
|
/* check if settings are valid */
|
||||||
|
if ((minify_setting != '0') && (minify_setting != '1'))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ((require_zero_setting != '0') && (require_zero_setting != '1'))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ((format_setting != '0') && (format_setting != '1'))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ((buffered_setting != '0') && (buffered_setting != '1'))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minify_setting == '1')
|
||||||
|
{
|
||||||
|
minify(data + data_offset, size);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
json = cJSON_ParseWithOpts((const char*)data + data_offset, NULL, (require_zero_setting == '1'));
|
||||||
|
if (json == NULL)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
printing(json, format_setting, buffered_setting);
|
||||||
|
|
||||||
|
free(json);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef CJSON_FUZZ_TARGET
|
||||||
|
#define CJSON_FUZZ_TARGET
|
||||||
|
|
||||||
|
extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
|
||||||
|
|
||||||
|
#endif /* CJSON_FUZZ_TARGET */
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
bf{
|
0111{
|
||||||
"glossary": {
|
"glossary": {
|
||||||
"title": "example glossary",
|
"title": "example glossary",
|
||||||
"GlossDiv": {
|
"GlossDiv": {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
bf["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
0111["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
bf{
|
0111{
|
||||||
"name": "Jack (\"Bee\") Nimble",
|
"name": "Jack (\"Bee\") Nimble",
|
||||||
"format": {"type": "rect",
|
"format": {"type": "rect",
|
||||||
"width": 1920,
|
"width": 1920,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
bf{"menu": {
|
0111{"menu": {
|
||||||
"id": "file",
|
"id": "file",
|
||||||
"value": "File",
|
"value": "File",
|
||||||
"popup": {
|
"popup": {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
bf{"widget": {
|
0111{"widget": {
|
||||||
"debug": "on",
|
"debug": "on",
|
||||||
"window": {
|
"window": {
|
||||||
"title": "Sample Konfabulator Widget",
|
"title": "Sample Konfabulator Widget",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
bu{"widget": {
|
0101{"widget": {
|
||||||
"debug": "on",
|
"debug": "on",
|
||||||
"window": {
|
"window": {
|
||||||
"title": "Sample Konfabulator Widget",
|
"title": "Sample Konfabulator Widget",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
uf{"widget": {
|
0110{"widget": {
|
||||||
"debug": "on",
|
"debug": "on",
|
||||||
"window": {
|
"window": {
|
||||||
"title": "Sample Konfabulator Widget",
|
"title": "Sample Konfabulator Widget",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
uu{"widget": {
|
0100{"widget": {
|
||||||
"debug": "on",
|
"debug": "on",
|
||||||
"window": {
|
"window": {
|
||||||
"title": "Sample Konfabulator Widget",
|
"title": "Sample Konfabulator Widget",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
bf{"web-app": {
|
0111{"web-app": {
|
||||||
"servlet": [
|
"servlet": [
|
||||||
{
|
{
|
||||||
"servlet-name": "cofaxCDS",
|
"servlet-name": "cofaxCDS",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
bf{"menu": {
|
0111{"menu": {
|
||||||
"header": "SVG Viewer",
|
"header": "SVG Viewer",
|
||||||
"items": [
|
"items": [
|
||||||
{"id": "Open"},
|
{"id": "Open"},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
bf<!DOCTYPE html>
|
0111<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
bf[
|
0111[
|
||||||
{
|
{
|
||||||
"precision": "zip",
|
"precision": "zip",
|
||||||
"Latitude": 37.7668,
|
"Latitude": 37.7668,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
bf{
|
0111{
|
||||||
"Image": {
|
"Image": {
|
||||||
"Width": 800,
|
"Width": 800,
|
||||||
"Height": 600,
|
"Height": 600,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
bf[
|
0111[
|
||||||
[0, -1, 0],
|
[0, -1, 0],
|
||||||
[1, 0, 0],
|
[1, 0, 0],
|
||||||
[0, 0, 1]
|
[0, 0, 1]
|
||||||
|
|||||||
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir -p libfuzzer-build || exit 1
|
||||||
|
cd libfuzzer-build || exit 1
|
||||||
|
#cleanup
|
||||||
|
rm -r -- *
|
||||||
|
|
||||||
|
CC=clang cmake ../.. -DENABLE_FUZZING=On -DENABLE_SANITIZERS=On -DBUILD_SHARED_LIBS=Off -DCMAKE_BUILD_TYPE=Debug -DENABLE_LIBFUZZER=On
|
||||||
|
make fuzz-target
|
||||||
@@ -25,6 +25,14 @@ if(ENABLE_CJSON_TEST)
|
|||||||
target_compile_options(unity PRIVATE "-fno-sanitize=float-divide-by-zero")
|
target_compile_options(unity PRIVATE "-fno-sanitize=float-divide-by-zero")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
# Disable -Wswitch-enum for Unity
|
||||||
|
if (FLAG_SUPPORTED_Wswitchenum)
|
||||||
|
if ("${CMAKE_VERSION}" VERSION_LESS "2.8.12")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-switch-enum")
|
||||||
|
else()
|
||||||
|
target_compile_options(unity PRIVATE "-Wno-switch-enum")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
#copy test files
|
#copy test files
|
||||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/inputs")
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/inputs")
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ static cJSON_bool test_apply_patch(const cJSON * const test)
|
|||||||
return successful;
|
return successful;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cJSON_bool test_generate_test(cJSON *test __attribute__((unused)))
|
static cJSON_bool test_generate_test(cJSON *test)
|
||||||
{
|
{
|
||||||
cJSON *doc = NULL;
|
cJSON *doc = NULL;
|
||||||
cJSON *patch = NULL;
|
cJSON *patch = NULL;
|
||||||
|
|||||||
@@ -304,6 +304,26 @@ static void cjson_replace_item_via_pointer_should_replace_items(void)
|
|||||||
cJSON_free(array);
|
cJSON_free(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cjson_replace_item_in_object_should_preserve_name(void)
|
||||||
|
{
|
||||||
|
cJSON root[1] = {{ NULL, NULL, NULL, 0, NULL, 0, 0, NULL }};
|
||||||
|
cJSON *child = NULL;
|
||||||
|
cJSON *replacement = NULL;
|
||||||
|
|
||||||
|
child = cJSON_CreateNumber(1);
|
||||||
|
TEST_ASSERT_NOT_NULL(child);
|
||||||
|
replacement = cJSON_CreateNumber(2);
|
||||||
|
TEST_ASSERT_NOT_NULL(replacement);
|
||||||
|
|
||||||
|
cJSON_AddItemToObject(root, "child", child);
|
||||||
|
cJSON_ReplaceItemInObject(root, "child", replacement);
|
||||||
|
|
||||||
|
TEST_ASSERT_TRUE(root->child == replacement);
|
||||||
|
TEST_ASSERT_EQUAL_STRING("child", replacement->string);
|
||||||
|
|
||||||
|
cJSON_Delete(replacement);
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
UNITY_BEGIN();
|
UNITY_BEGIN();
|
||||||
@@ -317,6 +337,7 @@ int main(void)
|
|||||||
RUN_TEST(cjson_set_number_value_should_set_numbers);
|
RUN_TEST(cjson_set_number_value_should_set_numbers);
|
||||||
RUN_TEST(cjson_detach_item_via_pointer_should_detach_items);
|
RUN_TEST(cjson_detach_item_via_pointer_should_detach_items);
|
||||||
RUN_TEST(cjson_replace_item_via_pointer_should_replace_items);
|
RUN_TEST(cjson_replace_item_via_pointer_should_replace_items);
|
||||||
|
RUN_TEST(cjson_replace_item_in_object_should_preserve_name);
|
||||||
|
|
||||||
return UNITY_END();
|
return UNITY_END();
|
||||||
}
|
}
|
||||||
+2
-2
@@ -31,8 +31,8 @@
|
|||||||
static void parse_hex4_should_parse_all_combinations(void)
|
static void parse_hex4_should_parse_all_combinations(void)
|
||||||
{
|
{
|
||||||
unsigned int number = 0;
|
unsigned int number = 0;
|
||||||
unsigned char digits_lower[5];
|
unsigned char digits_lower[6];
|
||||||
unsigned char digits_upper[5];
|
unsigned char digits_upper[6];
|
||||||
/* test all combinations */
|
/* test all combinations */
|
||||||
for (number = 0; number <= 0xFFFF; number++)
|
for (number = 0; number <= 0xFFFF; number++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,16 +49,16 @@ static void print_number_should_print_zero(void)
|
|||||||
|
|
||||||
static void print_number_should_print_negative_integers(void)
|
static void print_number_should_print_negative_integers(void)
|
||||||
{
|
{
|
||||||
assert_print_number("-1", -1);
|
assert_print_number("-1", -1.0);
|
||||||
assert_print_number("-32768", -32768);
|
assert_print_number("-32768", -32768.0);
|
||||||
assert_print_number("-2147483648", -2147483648.0);
|
assert_print_number("-2147483648", -2147483648.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_number_should_print_positive_integers(void)
|
static void print_number_should_print_positive_integers(void)
|
||||||
{
|
{
|
||||||
assert_print_number("1", 1);
|
assert_print_number("1", 1.0);
|
||||||
assert_print_number("32767", 32767);
|
assert_print_number("32767", 32767.0);
|
||||||
assert_print_number("2147483647", 2147483647);
|
assert_print_number("2147483647", 2147483647.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_number_should_print_positive_reals(void)
|
static void print_number_should_print_positive_reals(void)
|
||||||
@@ -68,6 +68,7 @@ static void print_number_should_print_positive_reals(void)
|
|||||||
assert_print_number("1000000000000", 10e11);
|
assert_print_number("1000000000000", 10e11);
|
||||||
assert_print_number("1.23e+129", 123e+127);
|
assert_print_number("1.23e+129", 123e+127);
|
||||||
assert_print_number("1.23e-126", 123e-128);
|
assert_print_number("1.23e-126", 123e-128);
|
||||||
|
assert_print_number("3.1415926535897931", 3.1415926535897931);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_number_should_print_negative_reals(void)
|
static void print_number_should_print_negative_reals(void)
|
||||||
|
|||||||
@@ -704,9 +704,9 @@ int UnityTestMatches(void);
|
|||||||
#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_ARRAY)
|
#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_ARRAY)
|
||||||
#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_ARRAY)
|
#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_ARRAY)
|
||||||
#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_ARRAY)
|
#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_ARRAY)
|
||||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_ARRAY)
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_VAL)
|
||||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_ARRAY)
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_VAL)
|
||||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_ARRAY)
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_VAL)
|
||||||
#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||||
#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
||||||
#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
||||||
|
|||||||
Reference in new issue
Block a user