Remove json checks in fuzzer SAPI

JSON is now always enabled
This commit is contained in:
Nikita Popov 2020-05-29 12:05:42 +02:00
parent 7aa8c7e6aa
commit 7562679b45
2 changed files with 1 additions and 12 deletions

View file

@ -76,11 +76,8 @@ if test "$PHP_FUZZER" != "no"; then
PHP_FUZZER_TARGET([parser], PHP_FUZZER_PARSER_OBJS) PHP_FUZZER_TARGET([parser], PHP_FUZZER_PARSER_OBJS)
PHP_FUZZER_TARGET([unserialize], PHP_FUZZER_UNSERIALIZE_OBJS) PHP_FUZZER_TARGET([unserialize], PHP_FUZZER_UNSERIALIZE_OBJS)
PHP_FUZZER_TARGET([json], PHP_FUZZER_JSON_OBJS)
dnl json extension is enabled by default
if (test -n "$enable_json" && test "$enable_json" != "no") || test -z "$PHP_ENABLE_ALL"; then
PHP_FUZZER_TARGET([json], PHP_FUZZER_JSON_OBJS)
fi
if test -n "$enable_exif" && test "$enable_exif" != "no"; then if test -n "$enable_exif" && test "$enable_exif" != "no"; then
PHP_FUZZER_TARGET([exif], PHP_FUZZER_EXIF_OBJS) PHP_FUZZER_TARGET([exif], PHP_FUZZER_EXIF_OBJS)
fi fi

View file

@ -28,13 +28,9 @@
#include <stdlib.h> #include <stdlib.h>
#include "fuzzer-sapi.h" #include "fuzzer-sapi.h"
#ifdef HAVE_JSON
#include "ext/json/php_json_parser.h" #include "ext/json/php_json_parser.h"
#endif
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
#ifdef HAVE_JSON
char *data = malloc(Size+1); char *data = malloc(Size+1);
memcpy(data, Data, Size); memcpy(data, Data, Size);
data[Size] = '\0'; data[Size] = '\0';
@ -55,10 +51,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
php_request_shutdown(NULL); php_request_shutdown(NULL);
free(data); free(data);
#else
fprintf(stderr, "\n\nERROR:\nPHP built without JSON, recompile with --enable-json to use this fuzzer\n");
exit(1);
#endif
return 0; return 0;
} }