diff --git a/projects/telegram/Dockerfile b/projects/telegram/Dockerfile new file mode 100644 index 000000000000..f57fb0c55a47 --- /dev/null +++ b/projects/telegram/Dockerfile @@ -0,0 +1,27 @@ +# Copyright 2025 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 + +# Clone the repository with fuzzing branch +RUN git clone --depth 1 https://github.com/telegramdesktop/tdesktop $SRC/tdesktop + +# Create fuzzer directory +RUN mkdir -p $SRC/telegram_fuzzers + +# Copy build script and standalone fuzzer sources to fuzzer directory +COPY build.sh $SRC/ +COPY *.cpp $SRC/telegram_fuzzers/ + +WORKDIR $SRC/telegram_fuzzers diff --git a/projects/telegram/build.sh b/projects/telegram/build.sh new file mode 100644 index 000000000000..24d32452dfd3 --- /dev/null +++ b/projects/telegram/build.sh @@ -0,0 +1,40 @@ +#!/bin/bash -eu +# Copyright 2025 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. + +# Build Telegram Protocol Fuzzers +# These are standalone fuzzers that don't require the full tdesktop build + +cd $SRC/telegram_fuzzers + +# List of fuzzers to build +FUZZERS=( + "mtproto_v0_fuzzer" + "mtproto_v1_obfuscated_fuzzer" + "mtproto_vd_padded_fuzzer" + "tl_serialization_fuzzer" + "aes_ctr_obfuscation_fuzzer" + "aes_ige_encryption_fuzzer" + "message_key_derivation_fuzzer" + "auth_key_management_fuzzer" +) + +# Build each fuzzer +for fuzzer in "${FUZZERS[@]}"; do + echo "Building $fuzzer..." + $CXX $CXXFLAGS -std=c++20 -c "${fuzzer}.cpp" -o "${fuzzer}.o" + $CXX $CXXFLAGS $LIB_FUZZING_ENGINE "${fuzzer}.o" -o "$OUT/${fuzzer}" +done + +echo "All fuzzers built successfully!" diff --git a/projects/telegram/project.yaml b/projects/telegram/project.yaml new file mode 100644 index 000000000000..8c19c5698e24 --- /dev/null +++ b/projects/telegram/project.yaml @@ -0,0 +1,17 @@ +homepage: "https://github.com/telegramdesktop/tdesktop" +language: c++ +primary_contact: "security@telegram.org" +main_repo: "https://github.com/telegramdesktop/tdesktop" +file_github_issue: true + +sanitizers: + - address + - undefined + - memory + +architectures: + - x86_64 + +help_url: "https://github.com/telegramdesktop/tdesktop/" + +view_restrictions: none