]> granicus.if.org Git - php/commitdiff
Remove json checks in fuzzer SAPI
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 29 May 2020 10:05:42 +0000 (12:05 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 29 May 2020 10:08:45 +0000 (12:08 +0200)
JSON is now always enabled

sapi/fuzzer/config.m4
sapi/fuzzer/fuzzer-json.c

index 37945b8e9ea3f2532e8f2590b04a60dd2dd37d8c..8e15a274ec1c5eb8d6c0c76d15210b309a542d29 100644 (file)
@@ -76,11 +76,8 @@ if test "$PHP_FUZZER" != "no"; then
 
   PHP_FUZZER_TARGET([parser], PHP_FUZZER_PARSER_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
     PHP_FUZZER_TARGET([exif], PHP_FUZZER_EXIF_OBJS)
   fi
index 45ec78ae4c0db7c0810139e6c5b8f6bae166ebfd..85fa8bbc8e5b606166e87128bea168d9133c7f73 100644 (file)
 #include <stdlib.h>
 
 #include "fuzzer-sapi.h"
-
-#ifdef HAVE_JSON
 #include "ext/json/php_json_parser.h"
-#endif
 
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
-#ifdef HAVE_JSON
        char *data = malloc(Size+1);
        memcpy(data, Data, Size);
        data[Size] = '\0';
@@ -55,10 +51,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
        php_request_shutdown(NULL);
 
        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;
 }