Skip to content

Commit 5cc77a3

Browse files
authored
[libjpeg-turbo] Fuzz multiple code branches (#7528)
libjpeg-turbo uses a stable mainline branch model, so the main branch is always stable and feeds into the current release series. The next-gen evolving release series is developed in the dev branch, and bug fixes are cherry-picked into stable branches for past release series. It is desirable to fuzz the dev branch to ensure that bugs are caught before the evolving code is merged down into main (which generally occurs in conjunction with a beta release) and also to allow for the fuzzers themselves to evolve along with the libjpeg-turbo feature set. It is also desirable to fuzz the stable branch from the most recent release series (2.0.x at the moment) to ensure that the same quality is maintained from when that code occupied the main branch. Note that both the Dockerfile and multi-branch build script included in this commit accommodate the fact that the dev branch may not exist. The dev branch will not exist between the time that the current release series enters beta and the first feature for the next-gen release series is developed. Closes #7479
1 parent baccece commit 5cc77a3

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

projects/libjpeg-turbo/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright 2016 Google Inc.
2+
# Copyright 2022 D. R. Commander
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License");
45
# you may not use this file except in compliance with the License.
@@ -16,12 +17,13 @@
1617

1718
FROM gcr.io/oss-fuzz-base/base-builder
1819
RUN apt-get update && apt-get install -y make yasm cmake
19-
RUN git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo
20+
RUN git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo libjpeg-turbo.main
21+
RUN git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo -b 2.0.x libjpeg-turbo.2.0.x
22+
RUN git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo -b dev libjpeg-turbo.dev || /bin/true
2023

2124
RUN git clone --depth 1 https://github.com/libjpeg-turbo/seed-corpora
2225
RUN cd seed-corpora && zip -r ../decompress_fuzzer_seed_corpus.zip afl-testcases/jpeg* bugs/decompress* $SRC/libjpeg-turbo/testimages/*.jpg
2326
RUN cd seed-corpora && zip -r ../compress_fuzzer_seed_corpus.zip afl-testcases/bmp afl-testcases/gif* bugs/compress* $SRC/libjpeg-turbo/testimages/*.bmp $SRC/libjpeg-turbo/testimages/*.ppm
2427
RUN rm -rf seed-corpora
2528

26-
WORKDIR libjpeg-turbo
27-
RUN cp fuzz/build.sh $SRC/
29+
COPY build.sh $SRC/

projects/libjpeg-turbo/build.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2022 D. R. Commander
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
################################################################################
16+
17+
set -e
18+
set -u
19+
20+
for branch in main 2.0.x dev; do
21+
if [ "$branch" = "dev" -a ! -d libjpeg-turbo.$branch ]; then
22+
continue
23+
fi
24+
pushd libjpeg-turbo.$branch
25+
if [ "$branch" = "main" ]; then
26+
sh fuzz/build.sh
27+
else
28+
sh fuzz/build.sh _$branch
29+
fi
30+
popd
31+
done

0 commit comments

Comments
 (0)