mirror of https://github.com/google/oss-fuzz.git
spring-bean: initial integration (#8287)
Add BeanWrapper test for spring-bean
This commit is contained in:
parent
db700e3ca8
commit
129f8f2639
|
@ -0,0 +1,112 @@
|
|||
import com.code_intelligence.jazzer.api.FuzzedDataProvider;
|
||||
import org.springframework.beans.BeanWrapper;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
import org.springframework.beans.ConversionNotSupportedException;
|
||||
import org.springframework.beans.InvalidPropertyException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BeanWrapperFuzzer {
|
||||
public static void fuzzerTestOneInput(FuzzedDataProvider data) {
|
||||
String property = data.consumeString(100);
|
||||
Bean bean = new Bean();
|
||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||
try {
|
||||
bw.setPropertyValue(property, data.consumeRemainingAsString());
|
||||
bw.getPropertyType(property);
|
||||
} catch (ConversionNotSupportedException | InvalidPropertyException ignored) {}
|
||||
}
|
||||
|
||||
public static class Bean {
|
||||
|
||||
private String prop;
|
||||
|
||||
private Bean nested;
|
||||
|
||||
private Bean[] array;
|
||||
|
||||
private Bean[][] multiArray;
|
||||
|
||||
private Bean[][][] threeDimensionalArray;
|
||||
|
||||
private List<Bean> list;
|
||||
|
||||
private List<List<Bean>> multiList;
|
||||
|
||||
private List listNotParameterized;
|
||||
|
||||
private Map<String, Bean> map;
|
||||
|
||||
public String getProp() {
|
||||
return prop;
|
||||
}
|
||||
|
||||
public void setProp(String prop) {
|
||||
this.prop = prop;
|
||||
}
|
||||
|
||||
public Bean getNested() {
|
||||
return nested;
|
||||
}
|
||||
|
||||
public void setNested(Bean nested) {
|
||||
this.nested = nested;
|
||||
}
|
||||
|
||||
public Bean[] getArray() {
|
||||
return array;
|
||||
}
|
||||
|
||||
public void setArray(Bean[] array) {
|
||||
this.array = array;
|
||||
}
|
||||
|
||||
public Bean[][] getMultiArray() {
|
||||
return multiArray;
|
||||
}
|
||||
|
||||
public void setMultiArray(Bean[][] multiArray) {
|
||||
this.multiArray = multiArray;
|
||||
}
|
||||
|
||||
public Bean[][][] getThreeDimensionalArray() {
|
||||
return threeDimensionalArray;
|
||||
}
|
||||
|
||||
public void setThreeDimensionalArray(Bean[][][] threeDimensionalArray) {
|
||||
this.threeDimensionalArray = threeDimensionalArray;
|
||||
}
|
||||
|
||||
public List<Bean> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<Bean> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public List<List<Bean>> getMultiList() {
|
||||
return multiList;
|
||||
}
|
||||
|
||||
public void setMultiList(List<List<Bean>> multiList) {
|
||||
this.multiList = multiList;
|
||||
}
|
||||
|
||||
public List getListNotParameterized() {
|
||||
return listNotParameterized;
|
||||
}
|
||||
|
||||
public void setListNotParameterized(List listNotParameterized) {
|
||||
this.listNotParameterized = listNotParameterized;
|
||||
}
|
||||
|
||||
public Map<String, Bean> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public void setMap(Map<String, Bean> map) {
|
||||
this.map = map;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,17 +23,17 @@ rsync -aL --exclude=*.zip "/usr/lib/jvm/java-17-openjdk-amd64/" "$JAVA_HOME"
|
|||
|
||||
cat > patch.diff <<- EOM
|
||||
diff --git a/spring-core/spring-core.gradle b/spring-core/spring-core.gradle
|
||||
index d9ce720..dc4e1c6 100644
|
||||
index 6546aa7..3e83242 100644
|
||||
--- a/spring-core/spring-core.gradle
|
||||
+++ b/spring-core/spring-core.gradle
|
||||
@@ -3,6 +3,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
@@ -4,6 +4,7 @@ import org.springframework.build.shadow.ShadowSource
|
||||
description = "Spring Core"
|
||||
|
||||
apply plugin: "kotlin"
|
||||
+apply plugin: 'com.github.johnrengelman.shadow'
|
||||
|
||||
// spring-core includes asm, javapoet and repackages cglib, inlining all into the
|
||||
// spring-core jar. cglib itself depends on asm and is therefore further transformed by
|
||||
def javapoetVersion = "1.13.0"
|
||||
def objenesisVersion = "3.2"
|
||||
EOM
|
||||
|
||||
git apply patch.diff
|
||||
|
@ -73,4 +73,6 @@ LD_LIBRARY_PATH=\"\$this_dir/open-jdk-17/lib/server\":\$this_dir \
|
|||
--jvm_args=\"-Xmx2048m\" \
|
||||
\$@" > $OUT/$fuzzer_basename
|
||||
chmod u+x $OUT/$fuzzer_basename
|
||||
done
|
||||
done
|
||||
|
||||
cp $SRC/BeanWrapperFuzzer\$Bean.class $OUT/
|
||||
|
|
Loading…
Reference in New Issue