From 20902d5b40cbcd566d255be02012ddb698692eb3 Mon Sep 17 00:00:00 2001 From: Uriel Chemouni Date: Thu, 23 Mar 2023 16:27:20 +0200 Subject: [PATCH] update json-smart-v2 build.sh and maintainer info (#9977) - Add primary_contact. - Update the build script to perform a full build with local dependencies. - Format JSONParserFuzzer.java --- projects/json-smart-v2/JSONParserFuzzer.java | 5 ++--- projects/json-smart-v2/build.sh | 14 +++++++++++--- projects/json-smart-v2/project.yaml | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/projects/json-smart-v2/JSONParserFuzzer.java b/projects/json-smart-v2/JSONParserFuzzer.java index 7f20ac1ce..3dbf511d0 100644 --- a/projects/json-smart-v2/JSONParserFuzzer.java +++ b/projects/json-smart-v2/JSONParserFuzzer.java @@ -23,10 +23,9 @@ public class JSONParserFuzzer { public static void fuzzerTestOneInput(FuzzedDataProvider data) { String input = data.consumeRemainingAsString(); JSONParser jp = new JSONParser(JSONParser.MODE_PERMISSIVE); - try{ + try { jp.parse(input); - } - catch( ParseException | NumberFormatException e){ + } catch (ParseException | NumberFormatException e) { return; } } diff --git a/projects/json-smart-v2/build.sh b/projects/json-smart-v2/build.sh index 9025e75dc..2b8e0d51d 100755 --- a/projects/json-smart-v2/build.sh +++ b/projects/json-smart-v2/build.sh @@ -17,13 +17,22 @@ mv $SRC/{*.zip,*.dict} $OUT +MAVEN_ARGS="-DskipTests -Djavac.src.version=15 -Djavac.target.version=15 \ +-Dmaven.javadoc.skip=true -Dmaven.repo.local=$WORK/m2" + +# first install accessors-smart in local $WORK/m2. json-smart depends on it +cd accessors-smart +$MVN install $MAVEN_ARGS +cd .. + +# build the actual json-smart cd json-smart -MAVEN_ARGS="-DskipTests -Djavac.src.version=15 -Djavac.target.version=15 -Dmaven.javadoc.skip=true -Dmaven.repo.local=$WORK/m2" $MVN package org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade $MAVEN_ARGS CURRENT_VERSION=$($MVN org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \ -Dexpression=project.version -q -DforceStdout) cp "target/json-smart-$CURRENT_VERSION.jar" $OUT/json-smart.jar - +# do not include accessors-smart.jar in ALL_JARS as it is already included with +# maven-shade-plugin:3.2.4:shade ALL_JARS="json-smart.jar" # The classpath at build-time includes the project jars in $OUT as well as the @@ -38,7 +47,6 @@ for fuzzer in $(find $SRC -name '*Fuzzer.java'); do javac -cp $BUILD_CLASSPATH $fuzzer cp $SRC/$fuzzer_basename.class $OUT/ - # Create an execution wrapper that executes Jazzer with the correct arguments. echo "#!/bin/bash # LLVMFuzzerTestOneInput for fuzzer detection. diff --git a/projects/json-smart-v2/project.yaml b/projects/json-smart-v2/project.yaml index 2dee6af72..96e33fbf1 100644 --- a/projects/json-smart-v2/project.yaml +++ b/projects/json-smart-v2/project.yaml @@ -1,6 +1,6 @@ homepage: "https://github.com/netplex/json-smart-v2" language: jvm -primary_contact: "" +primary_contact: "uchemouni@gmail.com" fuzzing_engines: - "libfuzzer" sanitizers: