Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions projects/draco/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
# Copyright 2020 Google Inc.
#
# 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why delete all of this?

# limitations under the License.
#
################################################################################

FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y git cmake make pkg-config
RUN git clone --depth 1 https://github.com/google/draco draco
COPY build.sh $SRC/
WORKDIR $WORK/
RUN apt-get update && apt-get install -y cmake
RUN git clone --depth 1 https://github.com/google/draco.git /src/draco
COPY build.sh fuzz_decode.cc $SRC/
WORKDIR $SRC/draco
16 changes: 12 additions & 4 deletions projects/draco/build.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -eu
# Copyright 2020 Google Inc.
# 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.
Expand All @@ -12,7 +12,15 @@
# 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.
#
################################################################################

sh $SRC/draco/src/draco/tools/fuzz/build.sh
mkdir build && cd build
cmake -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" \
-DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DDRACO_TESTS=OFF -DDRACO_JS_GLUE=OFF ..
make -j$(nproc) draco_static

cd $SRC
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE fuzz_decode.cc \
-I/src/draco/src -I/src/draco/build \
/src/draco/build/libdraco.a \
-o $OUT/fuzz_decode
60 changes: 60 additions & 0 deletions projects/draco/fuzz_decode.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// 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.

// Fuzz target for Draco 3D mesh/point cloud decoding.
// Exercises DecodeMeshFromBuffer and DecodePointCloudFromBuffer on
// arbitrary (potentially malformed) compressed geometry data.

#include <cstddef>
#include <cstdint>
#include <memory>

#include "draco/compression/decode.h"
#include "draco/core/decoder_buffer.h"

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
draco::DecoderBuffer buffer;
buffer.Init(reinterpret_cast<const char *>(data), size);

draco::Decoder decoder;

// Try decoding as mesh first, then as point cloud.
auto mesh_status = decoder.DecodeMeshFromBuffer(&buffer);
if (mesh_status.ok()) {
auto mesh = std::move(mesh_status).value();
// Access decoded data to exercise attribute accessors.
for (int i = 0; i < mesh->num_attributes(); ++i) {
auto attr = mesh->attribute(i);
if (attr && mesh->num_points() > 0) {
std::vector<float> values(attr->num_components());
attr->GetValue(draco::AttributeValueIndex(0), values.data());
}
}
}

buffer.Init(reinterpret_cast<const char *>(data), size);
auto pc_status = decoder.DecodePointCloudFromBuffer(&buffer);
if (pc_status.ok()) {
auto pc = std::move(pc_status).value();
for (int i = 0; i < pc->num_attributes(); ++i) {
auto attr = pc->attribute(i);
if (attr && pc->num_points() > 0) {
std::vector<float> values(attr->num_components());
attr->GetValue(draco::AttributeValueIndex(0), values.data());
}
}
}

return 0;
}
11 changes: 1 addition & 10 deletions projects/draco/project.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
homepage: "https://github.com/google/draco"
main_repo: "https://github.com/google/draco"
language: c++
primary_contact: "fgalligan@google.com"
auto_ccs:
- "ostava@google.com"
- "vytyaz@google.com"
fuzzing_engines:
- libfuzzer
- honggfuzz
- centipede
main_repo: 'https://github.com/google/draco'
file_github_issue: True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why delete all of this?

Loading