diff --git a/src/draco/tools/fuzz/draco_animation_decoder_fuzzer.cc b/src/draco/tools/fuzz/draco_animation_decoder_fuzzer.cc new file mode 100644 index 000000000..355a45e60 --- /dev/null +++ b/src/draco/tools/fuzz/draco_animation_decoder_fuzzer.cc @@ -0,0 +1,30 @@ +// Copyright 2026 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. + +#include "draco/src/draco/animation/keyframe_animation.h" +#include "draco/src/draco/animation/keyframe_animation_decoder.h" +#include "draco/src/draco/compression/config/decoder_options.h" +#include "draco/src/draco/core/decoder_buffer.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + draco::DecoderBuffer buffer; + buffer.Init(reinterpret_cast(data), size); + + draco::KeyframeAnimation animation; + draco::KeyframeAnimationDecoder decoder; + draco::DecoderOptions options; + decoder.Decode(options, &buffer, &animation); + + return 0; +} diff --git a/src/draco/tools/fuzz/draco_obj_decoder_fuzzer.cc b/src/draco/tools/fuzz/draco_obj_decoder_fuzzer.cc new file mode 100644 index 000000000..9a3b88893 --- /dev/null +++ b/src/draco/tools/fuzz/draco_obj_decoder_fuzzer.cc @@ -0,0 +1,29 @@ +// Copyright 2026 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. + +#include "draco/src/draco/core/decoder_buffer.h" +#include "draco/src/draco/io/obj_decoder.h" +#include "draco/src/draco/mesh/mesh.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + draco::DecoderBuffer buffer; + buffer.Init(reinterpret_cast(data), size); + + draco::Mesh mesh; + draco::ObjDecoder decoder; + decoder.set_use_metadata(true); + decoder.DecodeFromBuffer(&buffer, &mesh); + + return 0; +} diff --git a/src/draco/tools/fuzz/draco_ply_decoder_fuzzer.cc b/src/draco/tools/fuzz/draco_ply_decoder_fuzzer.cc new file mode 100644 index 000000000..393814728 --- /dev/null +++ b/src/draco/tools/fuzz/draco_ply_decoder_fuzzer.cc @@ -0,0 +1,28 @@ +// Copyright 2026 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. + +#include "draco/src/draco/core/decoder_buffer.h" +#include "draco/src/draco/io/ply_decoder.h" +#include "draco/src/draco/mesh/mesh.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + draco::DecoderBuffer buffer; + buffer.Init(reinterpret_cast(data), size); + + draco::Mesh mesh; + draco::PlyDecoder decoder; + decoder.DecodeFromBuffer(&buffer, &mesh); + + return 0; +} diff --git a/src/draco/tools/fuzz/draco_stl_decoder_fuzzer.cc b/src/draco/tools/fuzz/draco_stl_decoder_fuzzer.cc new file mode 100644 index 000000000..3a576a540 --- /dev/null +++ b/src/draco/tools/fuzz/draco_stl_decoder_fuzzer.cc @@ -0,0 +1,26 @@ +// Copyright 2026 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. + +#include "draco/src/draco/core/decoder_buffer.h" +#include "draco/src/draco/io/stl_decoder.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + draco::DecoderBuffer buffer; + buffer.Init(reinterpret_cast(data), size); + + draco::StlDecoder decoder; + decoder.DecodeFromBuffer(&buffer); + + return 0; +}