Commit 10aa6e01 by 凌振

第三批

parent e5c5d04c
# git
# git
## 信息
| 名称 | 版本 | 源码地址 |
| ---- | ---------- | ------------------------------ |
| git | 2.48.0-rc1 | https://github.com/git/git.git |
## 编译过程
```shell
git clone https://github.com/git/git.git
cd git
make configure
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure
make
```
## fuzz过程
```shell
#diff命令 比较两个文件的不同
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/others/text/ -o ./output -m 2048 -t 2000 -- ./git diff @@ ./sh/git_test_case.sh
```
# Gstreamer
## 信息
| 名称 | 版本 | 源码地址 |
| --------- | ------ | -------------------------------------- |
| Gstreamer | master | https://github.com/GStreamer/gstreamer |
## 编译过程
```shell
#如果没有pip3 需要安装
apt install python3-pip
#安装meson
pip3 install --user meson
#安装ninja
apt install ninja-bulid
#安装依赖
git clone https://github.com/GStreamer/gstreamer
cd gstreamer
meson setup builddir //下载可能失败,多尝试几次
meson compile -C builddir
```
## fuzz过程
```shell
#创建所需文件夹
cd gstreamer
mkdir work #工作文件夹
mkdir out #目标与语料库
mkdir input #输入种子文件夹
mkdir output #afl-fuzz结果输出文件夹
#下载所需要的依赖库源码
cd .. #gstreamer同级文件夹
#下载ogg
git clone https://github.com/xiph/ogg.git
git clone https://gitee.com/ttsu00/ogg.git #国内源
#下载vorbis
git clone https://gitlab.xiph.org/xiph/vorbis.git
git clone https://gitee.com/ttsu00/vorbis.git #国内源
#下载theora
git clone https://github.com/xiph/theora.git
git clone https://gitee.com/ttsu00/theora.git #国内源
#单步执行脚本内容
#定义变量
export SRC=~ #gstreamer所在文件夹 例如 export SRC=/home/lingzhen
export OUT=~/gstreamer/output #例如 export OUT=/home/lingzhen/gstreamer/out
export WORK=~/gstreamer/work #例如 export WORK=/home/lingzhen/gstreamer/work
export CC=/home/fuzz_dir/AFL/afl-gcc
export CXX=/home/fuzz_dir/AFL/afl-g++
rm -rf $WORK/*
rm -rf $OUT/lib $OUT/*_seed_corpus.zip
PREFIX=$WORK/prefix
mkdir -p $PREFIX
export PKG_CONFIG="`which pkg-config` --static"
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export PATH=$PREFIX/bin:$PATH
# Minimize gst-debug level/code
export CFLAGS="$CFLAGS -DGST_LEVEL_MAX=2"
echo "CFLAGS : " $CFLAGS
echo "CXXFLAGS : " $CXXFLAGS
# Switch to work directory
cd $WORK
mkdir -p $OUT/lib/gstreamer-1.0
# build ogg
pushd $SRC/ogg
./autogen.sh
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --prefix="$PREFIX" --libdir="$PREFIX/lib"
make clean
make -j$(nproc)
make install
popd
# build vorbis
pushd $SRC/vorbis
./autogen.sh
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --prefix="$PREFIX" --libdir="$PREFIX/lib"
make clean
make -j$(nproc)
make install
popd
# build theora
pushd $SRC/theora
./autogen.sh
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --prefix="$PREFIX" --libdir="$PREFIX/lib"
make clean
make -j$(nproc)
make install
popd
# For now we only build core and base. Add other modules when/if needed
meson \
--prefix=$PREFIX \
--libdir=lib \
--default-library=shared \
--force-fallback-for=zlib \
-Db_lundef=false \
-Doss_fuzz=enabled \
-Dglib:oss_fuzz=enabled \
-Dglib:libmount=disabled \
-Dglib:tests=false \
-Ddoc=disabled \
-Dexamples=disabled \
-Dintrospection=disabled \
-Dgood=disabled \
-Dugly=disabled \
-Dbad=disabled \
-Dlibav=disabled \
-Dges=disabled \
-Dvaapi=disabled \
-Dsharp=disabled \
-Drs=disabled \
-Dpython=disabled \
-Dlibnice=disabled \
-Ddevtools=disabled \
-Drtsp_server=disabled \
-Dgst-examples=disabled \
-Dqt5=disabled \
-Dorc=disabled \
-Dgtk_doc=disabled \
-Dgstreamer:tracer_hooks=false \
-Dgst-plugins-base:opus=disabled \
-Dgst-plugins-base:pango=disabled \
_builddir \
$SRC/gstreamer
ninja -C _builddir
ninja -C _builddir install
# 若提示patchelf命令不存在,安装patchelf命令sudo apt install patchelf
# copy out the fuzzing binaries
for BINARY in $(find _builddir/ci/fuzzing -type f -executable -print)
do
BASENAME=${BINARY##*/}
rm -rf "$OUT/$BASENAME*"
cp $BINARY $OUT/$BASENAME
patchelf --set-rpath '$ORIGIN/lib' $OUT/$BASENAME
done
# 若提示zip命令不存在,安装patchelf命令sudo apt install zip
# copy any relevant corpus
for CORPUS in $(find "$SRC/gstreamer/ci/fuzzing" -type f -name "*.corpus"); do
BASENAME=${CORPUS##*/}
pushd "$SRC/gstreamer"
zip $OUT/${BASENAME%%.*}_seed_corpus.zip . -ws -r -i@$CORPUS
popd
done
# copy dependant libraries
find "$PREFIX/lib" -maxdepth 1 -type f -name "*.so*" -exec cp -d "{}" $OUT/lib \; -print
# add rpath that point to the correct place to all shared libraries
find "$OUT/lib" -maxdepth 1 -type f -name "*.so*" -exec patchelf --debug --set-rpath '$ORIGIN' {} \;
find "$PREFIX/lib" -maxdepth 1 -type l -name "*.so*" -exec cp -d "{}" $OUT/lib \; -print
find "$PREFIX/lib/gstreamer-1.0" -maxdepth 1 -type f -name "*.so" -exec cp -d "{}" $OUT/lib/gstreamer-1.0 \;
find "$OUT/lib/gstreamer-1.0" -type f -name "*.so*" -exec patchelf --debug --set-rpath '$ORIGIN/..' {} \;
# make it easier to spot dependency issues
find "$OUT/lib/gstreamer-1.0" -maxdepth 1 -type f -name "*.so" -print -exec ldd {} \;
cp $SRC/gstreamer/ci/fuzzing/gst-discoverer.corpus $SRC/gstreamer/input
/home/fuzz_dir/AFL/afl-fuzz -i $SRC/gstreamer/input/ -o $SRC/gstreamer/output/ $SRC/gstreamer/out/gst-discoverer @@
```
## 7zip
## 信息
| 名称 | 版本 | 源码地址 |
| ---- | ----- | -------------------------------- |
| 7zip | 24.06 | https://github.com/ip7z/7zip.git |
## 编译过程
```shell
git clone https://github.com/ip7z/7zip.git
cd 7zip
git switch 24.06
cd ./CPP/7zip/Bundles/Alone2
export CC=/home/fuzz_dir/AFL/afl-gcc
export CXX=/home/fuzz_dir/AFL/afl-g++
make -j -f makefile.gcc
```
### fuzz过程
```shell
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/archives/common/zip/ -o ./output ./_o/7zz @@
```
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment