-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
roaring-bitmap: initial integration (#10952)
Initial integration for project RoaringBitmap. --------- Signed-off-by: Arthur Chan <[email protected]>
- Loading branch information
1 parent
ee9f211
commit a76d1f8
Showing
4 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
########################################################################## | ||
FROM gcr.io/oss-fuzz-base/base-builder-jvm | ||
RUN git clone --depth 1 https://github.com/RoaringBitmap/RoaringBitmap RoaringBitmap | ||
COPY *.sh *.java $SRC/ | ||
WORKDIR $SRC/RoaringBitmap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
/////////////////////////////////////////////////////////////////////////// | ||
import com.code_intelligence.jazzer.api.FuzzedDataProvider; | ||
import org.roaringbitmap.longlong.Roaring64Bitmap; | ||
|
||
// Generated with https://github.com/ossf/fuzz-introspector/tree/main/tools/auto-fuzz | ||
// Minor modifications to beautify code and ensure exception is caught. | ||
// Heuristic name: jvm-autofuzz-heuristics-1 | ||
// Target method: [org.roaringbitmap.longlong.Roaring64Bitmap] public static org.roaringbitmap.longlong.Roaring64Bitmap bitmapOf(long[]) | ||
// Heuristic name: jvm-autofuzz-heuristics-2 | ||
// Target method: [org.roaringbitmap.longlong.Roaring64Bitmap] public void and(org.roaringbitmap.longlong.Roaring64Bitmap) | ||
// Target method: [org.roaringbitmap.longlong.Roaring64Bitmap] public void or(org.roaringbitmap.longlong.Roaring64Bitmap) | ||
// Target method: [org.roaringbitmap.longlong.Roaring64Bitmap] public void xor(org.roaringbitmap.longlong.Roaring64Bitmap) | ||
public class RoaringBitmapFuzzer { | ||
public static void fuzzerTestOneInput(FuzzedDataProvider data) { | ||
Roaring64Bitmap bitmap1 = Roaring64Bitmap.bitmapOf(data.consumeLongs(data.consumeInt(1, 10))); | ||
Roaring64Bitmap bitmap2 = Roaring64Bitmap.bitmapOf(data.consumeLongs(data.consumeInt(1, 10))); | ||
|
||
switch (data.consumeInt(1, 3)) { | ||
case 1: | ||
bitmap1.and(bitmap2); | ||
break; | ||
case 2: | ||
bitmap1.or(bitmap2); | ||
break; | ||
case 3: | ||
bitmap1.xor(bitmap2); | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash -eu | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
########################################################################## | ||
./gradlew clean build -x test -x javadoc -x sources | ||
|
||
CURRENT_VERSION=$(./gradlew properties | grep ^version: | cut -d" " -f2) | ||
|
||
cp "./RoaringBitmap/build/libs/RoaringBitmap-$CURRENT_VERSION.jar" $OUT/roaring-bitmap.jar | ||
cp "./shims/build/libs/shims-$CURRENT_VERSION.jar" $OUT/shims.jar | ||
|
||
ALL_JARS="roaring-bitmap.jar shims.jar" | ||
|
||
# The classpath at build-time includes the project jars in $OUT as well as the | ||
# Jazzer API. | ||
BUILD_CLASSPATH=$(echo $ALL_JARS | xargs printf -- "$OUT/%s:"):$JAZZER_API_PATH | ||
|
||
# All .jar and .class files lie in the same directory as the fuzzer at runtime. | ||
RUNTIME_CLASSPATH=$(echo $ALL_JARS | xargs printf -- "\$this_dir/%s:"):\$this_dir | ||
|
||
for fuzzer in $(find $SRC -maxdepth 1 -name '*Fuzzer.java') | ||
do | ||
fuzzer_basename=$(basename -s .java $fuzzer) | ||
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. | ||
this_dir=\$(dirname "\$0") | ||
if [[ "\$@" =~ (^| )-runs=[0-9]+($| ) ]] | ||
then | ||
mem_settings='-Xmx1900m:-Xss900k' | ||
else | ||
mem_settings='-Xmx2048m:-Xss1024k' | ||
fi | ||
LD_LIBRARY_PATH="$JVM_LD_LIBRARY_PATH":\$this_dir \ | ||
\$this_dir/jazzer_driver \ | ||
--agent_path=\$this_dir/jazzer_agent_deploy.jar \ | ||
--cp=$RUNTIME_CLASSPATH \ | ||
--target_class=$fuzzer_basename \ | ||
--jvm_args="\$mem_settings" \ | ||
\$@" > $OUT/$fuzzer_basename | ||
|
||
chmod u+x $OUT/$fuzzer_basename | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
homepage: https://github.com/RoaringBitmap/RoaringBitmap | ||
main_repo: https://github.com/RoaringBitmap/RoaringBitmap | ||
language: jvm | ||
fuzzing_engines: | ||
- libfuzzer | ||
sanitizers: | ||
- address | ||
primary_contact: "[email protected]" | ||
vendor_ccs: | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] |