Skip to content
Open
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
27 changes: 27 additions & 0 deletions projects/telegram/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions projects/telegram/build.sh
Original file line number Diff line number Diff line change
@@ -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!"
17 changes: 17 additions & 0 deletions projects/telegram/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
homepage: "https://github.com/telegramdesktop/tdesktop"
language: c++
primary_contact: "[email protected]"
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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you double confirm this is intended and also matches the policy of Telegram?

Copy link
Author

Choose a reason for hiding this comment

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

I'm not a telegram maintainer, but I'm on the way to integrating OSS-Fuzz with TG.