-
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.
Proposing new project: Python cbor2 (#11444)
`cbor2` is a Python CBOR (de)serializer with extensive tag support. It has nearly [2,000 dependents](https://github.com/agronholm/cbor2/network/dependents) on GitHub. It's used by many large blockchain projects, such as: - https://github.com/bitcoin-core/HWI - https://github.com/Blockstream/Jade - https://github.com/vyperlang/vyper - https://github.com/lidofinance/lido-dao - https://github.com/fetchai/cosmpy - https://github.com/OpShin/opshin And other non-blockchain projects, such as: - https://github.com/project-chip/connectedhomeip - https://github.com/pritunl/pritunl - https://github.com/amazon-ion/ion-python I received approval from this project here: agronholm/cbor2#204 (comment)
- Loading branch information
Showing
4 changed files
with
96 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,20 @@ | ||
# Copyright 2024 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-python | ||
RUN git clone --depth 1 https://github.com/agronholm/cbor2.git | ||
WORKDIR cbor2 | ||
COPY build.sh *.py $SRC/ |
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,27 @@ | ||
# Copyright 2024 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. | ||
# | ||
################################################################################ | ||
|
||
# Ensure C extension gets built | ||
export CBOR2_BUILD_C_EXTENSION=1 | ||
|
||
# Build and install project (using current CFLAGS, CXXFLAGS). This is required | ||
# for projects with C extensions so that they're built with the proper flags. | ||
pip3 install . | ||
|
||
# Build fuzzers in $OUT. | ||
for fuzzer in $(find $SRC -name '*_fuzzer.py'); do | ||
compile_python_fuzzer $fuzzer | ||
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,40 @@ | ||
#!/usr/bin/python3 | ||
|
||
# Copyright 2024 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 sys | ||
import atheris | ||
|
||
# _cbor2 ensures the C library is imported | ||
from _cbor2 import loads | ||
|
||
|
||
def test_one_input(data: bytes): | ||
try: | ||
loads(data) | ||
except Exception: | ||
# We're searching for memory corruption, not Python exceptions | ||
pass | ||
|
||
|
||
def main(): | ||
atheris.Setup(sys.argv, test_one_input) | ||
atheris.Fuzz() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,9 @@ | ||
homepage: "https://github.com/agronholm/cbor2" | ||
main_repo: "https://github.com/agronholm/cbor2" | ||
language: python | ||
primary_contact: "[email protected]" | ||
fuzzing_engines: | ||
- libfuzzer | ||
sanitizers: | ||
- address | ||
- undefined |