Commit fb45ed07 by 凌振

更新

parent 10aa6e01
// Copyright 2016 Google Inc. All Rights Reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
#include <stdint.h>
#include <stdlib.h>
#include <string>
#include <stdio.h>
#include <cstdlib>
int test_func(const uint8_t *Data, size_t Size) {
unsigned char *buf;
int buflen;
std::string s(reinterpret_cast<const char *>(Data), Size);
ares_create_query(s.c_str(), ns_c_in, ns_t_a, 0x1234, 0, &buf, &buflen, 0);
free(buf);
return 0;
}
int main(int argc, char *argv[]){
if(argc==1){
printf("%s\n", "usage");
return 0;
}
char* file_path = argv[1];
FILE *fp;
if((fp=fopen(file_path, "rb")) == NULL){
printf("cannot open file:%s\n", file_path);
return 0;
}
fseek(fp, 0, SEEK_END);
size_t file_len = ftell(fp);
uint8_t *tmp = (uint8_t*)malloc(sizeof(uint8_t) * file_len);
fseek(fp, 0, SEEK_SET);
fread(tmp, file_len, sizeof(uint8_t), fp);
fclose(fp);
test_func(tmp, file_len);
return 0;
}
No preview for this file type
# git # 备注
# 备注
**Ps:带*的是没有fuzz成功的项目**
```shell
#asan编译
AFL_USE_ASAN=1 make -j4
```
```shell
#AFL Fuzz启动测试
echo core >/proc/sys/kernel/core_pattern
cd /sys/devices/system/cpu
echo performance | tee cpu*/cpufreq/scaling_governor
```
# git # git
## 信息 ## 信息
...@@ -198,7 +214,7 @@ cp $SRC/gstreamer/ci/fuzzing/gst-discoverer.corpus $SRC/gstreamer/input ...@@ -198,7 +214,7 @@ cp $SRC/gstreamer/ci/fuzzing/gst-discoverer.corpus $SRC/gstreamer/input
``` ```
## 7zip # 7zip
## 信息 ## 信息
...@@ -218,8 +234,2601 @@ export CXX=/home/fuzz_dir/AFL/afl-g++ ...@@ -218,8 +234,2601 @@ export CXX=/home/fuzz_dir/AFL/afl-g++
make -j -f makefile.gcc make -j -f makefile.gcc
``` ```
### fuzz过程 ## fuzz过程
```shell
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/archives/common/zip/ -o ./output ./_o/7zz e @@
```
------
# yyjson(库)
| 名称 | 版本 | 源码地址 | 更新时间 |
| ------ | ------ | --------------------------------------------- | ---------- |
| yyjson | master | https://github.com/ibireme/yyjson/tree/master | 2024-12-09 |
`yyjson` 是一个 **高性能** 的 JSON 解析和生成库,主要用 C 语言编写。它旨在提供 **速度快、内存占用少** 的 JSON 处理能力,同时保持 **简单易用** 的 API。`yyjson` 强调 **零拷贝**,尽可能避免数据复制,从而提升性能。
## 编译过程
```shell
git https://github.com/ibireme/yyjson.git
cd yyjson
mkdir build
cd build
cmake ..
cmake --build .
```
## 创建可执行文件
```shell
cd ..
cd fuzz
vim target.c //输入以下内容
```
`target.c`内容
```c
#include <yyjson.h>
static void test_with_flags(const uint8_t *data, size_t size,
yyjson_read_flag rflg, yyjson_write_flag wflg) {
yyjson_doc *idoc = yyjson_read((const char *)data, size, rflg);
yyjson_mut_doc *mdoc = yyjson_doc_mut_copy(idoc, NULL);
char *ijson = yyjson_write(idoc, wflg, NULL);
if (ijson) free((void *)ijson);
char *mjson = yyjson_mut_write(mdoc, wflg, NULL);
if (mjson) free((void *)mjson);
yyjson_doc_free(idoc);
yyjson_mut_doc_free(mdoc);
}
int test_func(const uint8_t *data, size_t size) {
test_with_flags(data, size,
YYJSON_READ_NOFLAG,
YYJSON_WRITE_NOFLAG);
test_with_flags(data, size,
YYJSON_READ_ALLOW_TRAILING_COMMAS |
YYJSON_READ_ALLOW_COMMENTS |
YYJSON_READ_ALLOW_INF_AND_NAN,
YYJSON_WRITE_PRETTY |
YYJSON_WRITE_ESCAPE_UNICODE |
YYJSON_WRITE_ESCAPE_SLASHES |
YYJSON_WRITE_ALLOW_INF_AND_NAN);
return 0;
}
int main(int argc, char *argv[]){
if(argc==1){
printf("%s\n", "usage");
return 0;
}
char* file_path = argv[1];
FILE *fp;
if((fp=fopen(file_path, "rb")) == NULL){
printf("cannot open file:%s\n", file_path);
return 0;
}
fseek(fp, 0, SEEK_END);
size_t file_len = ftell(fp);
uint8_t *tmp = (uint8_t*)malloc(sizeof(uint8_t) * file_len);
fseek(fp, 0, SEEK_SET);
fread(tmp, file_len, sizeof(uint8_t), fp);
fclose(fp);
test_func(tmp, file_len);
return 0;
}
```
## fuzz过程
```shell
# -L 指定库路径 -I 指定头文件路径 -lyyjson指定引用
/home/fuzz_dir/AFL/afl-gcc -L /home/lingzhen/yyjson/build/ -I /home/lingzhen/yyjson/src/ target.c -o target -lyyjson
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/others/text/ -o ./output ./target @@
```
# mosquitto(协议)
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| --------- | ------ | ---------------------------------------------- | ---------- |
| mosquitto | master | https://github.com/eclipse-mosquitto/mosquitto | 2024-11-02 |
## 编译过程
```shell
git https://github.com/eclipse-mosquitto/mosquitto.git
cd mosquitto
export CC=/home/fuzz_dir/AFL/afl-gcc
export CXX=/home/fuzz_dir/AFL/afl-g++
sudo apt install libcjson1 libcjson-dev #若报下图错误,安装json库
make
```
![image-20250115094952972](./assets/image-20250115094952972.png)
# libtiff
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ------- | ------ | ---------------------------------- | ---------- |
| libtiff | master | https://gitlab.com/libtiff/libtiff | 2025-01-07 |
libtiff 是一个开源的 C 语言库,专门用于读取和写入 **Tagged Image File Format (TIFF)** 图像文件。TIFF 是一种灵活且可扩展的图像文件格式,广泛用于存储高质量的图像数据,尤其是在出版、医学成像、地理信息系统 (GIS) 和科学研究等领域。
## 编译过程
```shell
git clone https://gitlab.com/libtiff/libtiff
cd libtiff
export CC=/home/fuzz_dir/AFL/afl-gcc
export CXX=/home/fuzz_dir/AFL/afl-g++
./autogen.sh
./configure --disable-shared #若跑出来的可执行文件为script脚本 可以加这个参数
make
```
## fuzz过程
```shell
#在tool文件夹中有很多可执行文件可以被测试
cd tools
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/tiff/ -o ./output/ ./tools/tiff2pdf @@
```
# ncurses
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ------- | ------ | --------------------------------- | ---------- |
| ncurses | master | https://github.com/mirror/ncurses | 2023-02-26 |
ncurses (new curses) 是一个 **自由软件** 的编程库,它为程序员提供了一种在 **终端** 中创建和管理文本用户界面 (TUI) 的方式。它提供了各种函数,允许你控制终端屏幕上的文本、颜色、光标位置,并处理用户的输入。
简单来说,ncurses 让你能够在文本模式下,像图形用户界面 (GUI) 一样,创建具有交互性的应用程序。
## 编译过程
```shell
git clone https://github.com/mirror/ncurses.git
cd ncurses
export CC=/home/fuzz_dir/AFL/afl-gcc
export CXX=/home/fuzz_dir/AFL/afl-g++
./configure
make
```
## fuzz过程
```
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/others/text/ -o ./output ./progs/tic @@
```
# vim
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ---- | ------ | -------------------------- | ---------- |
| vim | master | https://github.com/vim/vim | 2025-01-09 |
## 编译过程
```shell
git clone https://github.com/vim/vim.git
cd vim
export CC=/home/fuzz_dir/AFL/afl-gcc
export CXX=/home/fuzz_dir/AFL/afl-g++
./configure --disable-shared
make
```
## fuzz过程
```
/home/fuzz_dir/AFL/afl-fuzz -m none -i /home/fuzz_dir/AFL/testcases/others/text/ -o ./output ./src/vim -u NONE -N -X -Z -e -s -c 'call search(getline("."))' -c ':qa!' @@
```
# opus
## 信息
Opus 是一种主要用于音频编码的开源有损编解码器
| 名称 | 版本 | 源码地址 | 更新时间 |
| ---- | ------ | --------------------------------- | ---------- |
| opus | master | https://gitlab.xiph.org/xiph/opus | 2024-10-16 |
## 编译过程
```shell
git https://gitlab.xiph.org/xiph/opus.git
cd opus
export CC=/home/fuzz_dir/AFL/afl-gcc
export CXX=/home/fuzz_dir/AFL/afl-g++
./autogen.sh
./configure --disable-shared
make
```
## fuzz过程
```shell
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/multimedia/h264 -o output ./opus_demo -e audio 48000 2 64000 @@ /dev/null
#参考链接:https://gitlab.xiph.org/xiph/opus/-/issues/2000
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/multimedia/h264 -o output ./opus_demo audio 48000 1 9000 -cbr @@ /dev/null
#-framesize:帧大小(毫秒);默认:20
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/multimedia/h264 -o output ./opus_demo audio 48000 2 64000 -framesize 120 @@ /dev/null
#-bandwidth:音频带宽(从窄带到全带) -inbandfec:启用SILK内带前向纠错(FEC) -forcemono:强制单声道编码,即使输入为立体声
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/multimedia/h264 -o output ./opus_demo audio 48000 2 64000 -bandwidth FB -inbandfec -forcemono @@ /dev/null
```
## 参数说明
> - `-e`
> **仅运行编码器(输出比特流)**
> 仅执行编码过程,将输入音频数据编码为比特流,不进行解码。
> - `-d`
> **仅运行解码器(读取比特流作为输入)**
> 仅执行解码过程,读取比特流并将其解码为音频数据,不进行编码。
>
> - `-cbr`
> **启用恒定比特率;默认:可变比特率**
> 设置编码器以恒定的比特率进行编码,保证输出比特流的速率稳定。
> - `-cvbr`
> **启用受限可变比特率;默认:不受限**
> 设置编码器以受限的可变比特率进行编码,平衡比特率与音质。
>
> - `-delayed-decision`
> **使用前瞻进行语音/音乐检测(仅限专家);默认:禁用**
> 启用高级的语音和音乐检测功能,通过前瞻分析优化编码效果。此选项通常需要专业知识,不建议普通用户使用。
> - `-bandwidth <NB|MB|WB|SWB|FB>`
> **音频带宽(从窄带到全带);默认:采样率**
> 设置编码器的音频带宽,选项包括:
> - `NB`:窄带(通常为8 kHz)
> - `MB`:中带
> - `WB`:宽带(通常为16 kHz)
> - `SWB`:超宽带(通常为32 kHz)
> - `FB`:全带(通常为48 kHz)
> - `-framesize <2.5|5|10|20|40|60|80|100|120>`
> **帧大小(毫秒);默认:20**
> 设置每帧音频的长度,单位为毫秒。常见的帧大小有2.5ms、5ms、10ms等。
>
> - `-max_payload <bytes>`
> **最大负载大小(字节),默认:1024**
> 设置每个编码包的最大字节数,影响数据传输的效率和延迟。
> - `-complexity <comp>`
> **编码器复杂度,0(最低)... 10(最高);默认:10**
> 设置编码器的复杂度级别,数值越高,编码质量越好但计算量越大。
> - `-dec_complexity <comp>`
> **解码器复杂度,0(最低)... 10(最高);默认:0**
> 设置解码器的复杂度级别,数值越高,解码质量和容错能力越好但计算量越大。
>
> - `-inbandfec`
> **启用SILK内带前向纠错(FEC)**
> 在编码数据中加入前向纠错信息,提高传输过程中的抗丢包能力。
> - `-forcemono`
> **强制单声道编码,即使输入为立体声**
> 将输入的立体声信号强制转换为单声道进行编码。
> - `-dtx`
> **启用SILK DTX(不连续传输)**
> 在静音或低能量音频段暂停发送数据,节省带宽。
>
> - `-loss <perc>`
> **针对丢失百分比进行优化并模拟数据包丢失,百分比范围(0-100);默认:0**
> 模拟指定百分比的数据包丢失情况,用于测试编码器在丢包环境下的表现。
> - `-lossfile <file>`
> **通过读取文件模拟数据包丢失**
> 使用指定的文件中的数据来模拟数据包丢失情况,提供更灵活的丢包模式。
> - `-dred <frames>`
> **添加深度冗余(以10毫秒帧为单位)**
> 在编码数据中添加额外的冗余信息,以提高在丢包情况下的恢复能力。参数`<frames>`表示添加冗余的帧数。
# OpenBSD(*)
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ------- | ------ | -------------------------------------------------- | ---------- |
| OpenBSD | master | https://ftp.openbsd.org/pub/OpenBSD/7.6/src.tar.gz | 2024-09-30 |
## 编译过程
```shell
wget https://ftp.openbsd.org/pub/OpenBSD/7.6/src.tar.gz
tar -xzvf src.tar.gz
cd src
export CC=/home/fuzz_dir/AFL/afl-gcc
export CXX=/home/fuzz_dir/AFL/afl-g++
./configure --disable-shared
make
```
## fuzz过程
```
/home/fuzz_dir/AFL/afl-fuzz -m none -i /home/fuzz_dir/AFL/testcases/others/text/ -o ./output ./src/vim -u NONE -N -X -Z -e -s -c 'call search(getline("."))' -c ':qa!' @@
```
# jerryscript(*)
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ----------- | ------ | -------------------------------------------------- | ---------- |
| jerryscript | master | https://github.com/jerryscript-project/jerryscript | 2024-12-17 |
## 编译过程
```shell
git clone https://github.com/jerryscript-project/jerryscript.git
cd jerryscript
export CC=/home/fuzz_dir/AFL/afl-gcc
export CXX=/home/fuzz_dir/AFL/afl-g++
mkdir build
cd build
cmake ..
make
```
## fuzz过程
```shell
```
# assimp(*)
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ------ | ------ | -------------------------------- | ---------- |
| assimp | master | https://github.com/assimp/assimp | 2025-01-08 |
Assimp (Open Asset Import Library) 是一个开源的、跨平台的 **3D 模型导入** 库。它的主要功能是将各种不同的 3D 模型文件格式(如 OBJ, FBX, glTF, STL 等)加载并转换为一个统一的、易于访问的中间数据结构。
简单来说,Assimp 让你不必为每种 3D 模型格式编写单独的解析器,而是可以使用一套通用的 API 来加载和处理不同格式的 3D 模型数据。
## 编译过程
```shell
git clone https://github.com/assimp/assimp.git
cd assimp
export CC=/home/fuzz_dir/AFL/afl-gcc
export CXX=/home/fuzz_dir/AFL/afl-g++
cmake CMakeLists.txt
cmake --build .
#若在编译过程中提示cmake版本过低请执行下面命令安装更高版本的cmake
sudo apt remove --purge cmake
wget https://cmake.org/files/v3.22/cmake-3.22.1.tar.gz
tar xzf cmake-3.22.1.tar.gz
cd cmake-3.22.1
./bootstrap
make
sudo make install
#若cmake --version没有结果,将bin添加的系统路径
vim ~/.bashrc
export PATH=/path/to/cmake/bin:$PATH #将 /path/to/cmake/bin 替换为你实际的路径。
source ~/.bashrc
cmake --version #验证是否生效
```
## 创建可执行文件
```shell
cd ..
cd fuzz
vim target.cc //输入以下内容
```
`target.c`内容
```c++
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2024, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
#include <assimp/cimport.h>
#include <assimp/Importer.hpp>
#include <assimp/Exporter.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
using namespace Assimp;
extern "C" int test_func(const uint8_t *data, size_t dataSize) {
#ifdef _DEBUG
aiLogStream stream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT, nullptr);
aiAttachLogStream(&stream);
#endif
Importer importer;
unsigned int flags = aiProcessPreset_TargetRealtime_Quality | aiProcess_ValidateDataStructure;
const aiScene *sc = importer.ReadFileFromMemory(data, dataSize, flags, nullptr);
if (sc == nullptr) {
return 0;
}
Exporter exporter;
exporter.ExportToBlob(sc, "fbx");
#ifdef _DEBUG
aiDetachLogStream(&stream);
#endif
return 0;
}
int main(int argc, char *argv[]){
if(argc==1){
printf("%s\n", "usage");
return 0;
}
char* file_path = argv[1];
FILE *fp;
if((fp=fopen(file_path, "rb")) == NULL){
printf("cannot open file:%s\n", file_path);
return 0;
}
fseek(fp, 0, SEEK_END);
size_t file_len = ftell(fp);
uint8_t *tmp = (uint8_t*)malloc(sizeof(uint8_t) * file_len);
fseek(fp, 0, SEEK_SET);
fread(tmp, file_len, sizeof(uint8_t), fp);
fclose(fp);
test_func(tmp, file_len);
return 0;
}
```
## fuzz过程
```shell
# -L 指定库路径 -I 指定头文件路径 -lxxx指定引用
/home/fuzz_dir/AFL/afl-gcc -L /home/lingzhen/assimp/bin/ -I /home/lingzhen/assimp/include/ target.cc -o target -lassimp
```
# uAMQP(*)
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ----- | ------ | -------------------------------------- | ---------- |
| uAMQP | master | https://github.com/Azure/azure-uamqp-c | 2025-01-07 |
## 编译过程
```shell
git clone https://github.com/Azure/azure-uamqp-c.git
cd azure-uamqp-c
mkdir cmake
cd cmake
cmake ..
cmake --build .
```
## fuzz过程
```shell
```
# FFmpeg
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ------ | ------ | -------------------------------- | ---------- |
| FFmpeg | master | https://github.com/FFmpeg/FFmpeg | 2025-01-12 |
## 编译过程
```shell
git https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
sudo apt install nasm
cc=/home/fuzz_dir/AFL/afl-gcc cxx=/home/fuzz_dir/AFL/afl-g++ ./configure
make
```
## fuzz过程
```shell ```shell
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/archives/common/zip/ -o ./output ./_o/7zz @@ # -m none命令 不限制内存
# /dev/null 是一个特殊的文件设备,通常用于丢弃数据。它的主要用途是将输出重定向到一个黑洞,即不保存任何数据。这在处理输出时非常有用,特别是当你想要屏蔽某些输出时。
/home/fuzz_dir/AFL/afl-fuzz -m none -i /home/fuzz_dir/AFL/testcases/multimedia/h264/ -o ./output ./ffmpeg -i @@ /dev/null
``` ```
![image-20250115093659757](./assets/image-20250115093659757.png)
# ZSTD
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ---- | ----- | -------------------------------- | ---------- |
| ZSTD | 1.5.7 | https://github.com/facebook/zstd | 2025-02-14 |
## 编译过程
```shell
git clone https://github.com/facebook/zstd
cd zstd
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ make -j 4
```
## fuzz过程
```shell
# -9:最高压缩级别(速度慢,压缩率高) -f:强制覆盖已存在的输出文件
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/others/sql/ -o ./output ./programs/zstd -9 -f @@ -o /dev/null
```
## 参数说明
> ### 基本选项
>
> - `-o OUTPUT`
> **将输出写入单个文件,OUTPUT。**
> 指定输出文件的名称。如果未指定,程序可能会根据上下文生成默认的输出文件名。
> - `-k, --keep`
> **保留输入文件。** [默认]
> 在处理后保留原始输入文件,不解压或删除它们。
> - `--rm`
> **成功(解)压缩后删除输入文件。**
> 在确保(解)压缩成功后,删除原始输入文件。
> - `-#`
> **期望的压缩级别,其中`#`是1到19之间的数字;较低的数字提供更快的压缩速度,较高的数字提供更好的压缩比。** [默认:3]
> 通过调整压缩级别来平衡压缩速度和压缩效率。
> - `-d, --decompress`
> **执行解压缩。**
> 指定程序应执行解压缩操作而不是压缩。
> - `-D DICT`
> **使用DICT作为压缩或解压缩的字典。**
> 指定一个预训练的字典文件,以提高压缩效率或兼容性。
> - `-f, --force`
> **禁用输入和输出检查。允许覆盖现有文件,从控制台接收输入,将输出打印到STDOUT,并操作链接、块设备等。未识别的格式将被原样传递。**
> 强制程序执行操作,忽略潜在的问题或警告。
> - `-h`
> **显示简短用法并退出。**
> 显示简要的帮助信息并终止程序。
> - `-H, --help`
> **显示完整帮助并退出。**
> 显示详细的帮助信息,包括所有选项和用法说明,并终止程序。
> - `-V, --version`
> **显示程序版本并退出。**
> 显示当前程序的版本信息并终止程序。
>
> ### 高级选项
>
> - `-c, --stdout`
> **将输出写入STDOUT(即使它是控制台)并保留输入文件。**
> 将处理后的数据输出到标准输出流,同时保留原始输入文件。
> - `-v, --verbose`
> **启用详细输出;多次传递以增加详细程度。**
> 提供更多的操作信息,帮助调试和监控进程。
> - `-q, --quiet`
> **抑制警告;传递两次以抑制错误。**
> 减少或隐藏程序运行时的警告和错误信息。
> - `--trace LOG`
> **将跟踪信息记录到LOG。**
> 记录详细的运行时信息,用于调试和分析。
> - `--[no-]progress`
> **强制显示/隐藏进度计数器。注意:任何(解)压缩输出到终端将与进度计数器文本混合。**
> 控制是否在终端显示进度条。
> - `-r`
> **递归处理目录。**
> 对指定目录及其所有子目录中的文件进行操作。
> - `--filelist LIST`
> **从LIST中读取要操作的文件列表。**
> 使用指定的文件列表作为操作目标。
> - `--output-dir-flat DIR`
> **将处理后的文件存储在DIR中。**
> 将所有输出文件存储在指定的单一目录中,不保留原始目录结构。
> - `--output-dir-mirror DIR`
> **将处理后的文件存储在DIR中,保留原始目录结构。**
> 在指定的目录中创建与原始文件相同的目录结构,并存储处理后的文件。
> - `[no-]asyncio`
> **使用异步IO。** [默认:启用]
> 控制是否使用异步I/O以提高性能。
> - `[no-]check`
> **在压缩期间添加XXH64完整性校验和。** [默认:添加,验证]
> 在压缩时添加校验和,并在解压缩时验证校验和。
> - `--`
> **将`--`之后的所有参数视为文件。**
> 允许在选项后直接传递文件名,避免与选项冲突。
>
> ### 高级压缩选项
>
> - `--ultra`
> **启用超过19的压缩级别,最高可达22;需要更多内存。**
> 使用更高的压缩级别以获得更好的压缩比,但会消耗更多内存。
> - `--fast[=#]`
> **使用非常快速的压缩级别。** [默认:1]
> 选择更快的压缩速度,牺牲一定的压缩比。
> - `--adapt`
> **根据I/O条件动态调整压缩级别。**
> 根据实时的I/O性能自动调整压缩级别,以优化性能和压缩比。
> - `--long[=#]`
> **启用长距离匹配,窗口日志为#。** [默认:27]
> 增加匹配窗口的大小,以提高压缩效果。
> - `--patch-from=REF`
> **使用REF作为Zstandard差分引擎的参考点。**
> 在压缩时使用指定的参考文件进行差分编码。
> - `-T#`
> **生成#个压缩线程。** [默认:1;传递0表示核心数。]
> 指定用于压缩的线程数量,以利用多核处理器提高性能。
> - `--single-thread`
> **共享单个线程用于I/O和压缩(与`-T1`略有不同)。**
> 使用单一线程处理I/O和压缩操作,适用于特定场景。
> - `--auto-threads={physical|logical}`
> **使用物理/逻辑核心,当使用`-T0`时。** [默认:物理]
> 根据物理或逻辑核心数自动设置线程数量。
> - `-B#`
> **将作业大小设置为#。** [默认:0(自动)]
> 指定每次处理的块大小,以优化性能。
> - `--rsyncable`
> **使用rsync友好的方法进行压缩(`-B`设置块大小)。**
> 使压缩后的文件更适合使用rsync进行增量备份。
> - `--exclude-compressed`
> **仅压缩未压缩的文件。**
> 跳过已经压缩的文件,避免重复压缩。
> - `--stream-size=#`
> **指定从STDIN输入的流大小。**
> 设置通过标准输入传递的数据流的大小。
> - `--size-hint=#`
> **针对大约#大小的流式输入优化压缩参数。**
> 根据预期的输入大小调整压缩参数,以获得更好的性能。
> - `--target-compressed-block-size=#`
> **生成大约#大小的压缩块。**
> 控制每个压缩块的目标大小,以优化存储或传输。
> - `--no-dictID`
> **不在头部写入`dictID`(仅限字典压缩)。**
> 在压缩时省略字典ID,适用于某些特定需求。
> - `[no-]compress-literals`
> **强制(不)压缩字面量。**
> 控制是否对字面量数据进行压缩。
> - `[no-]row-match-finder`
> **显式启用/禁用用于'greedy'、'lazy'和'lazy2'策略的快速行匹配查找器。**
> 选择不同的匹配查找算法,以优化压缩效果。
> - `--format=zstd`
> **将文件压缩为`.zst`格式。** [默认]
> 指定输出文件的格式为Zstandard。
> - `[no-]mmap-dict`
> **内存映射字典文件,而不是malloc并一次性加载所有内容。**
> 使用内存映射方式加载字典文件,提高内存使用效率。
> - `--format=gzip`
> **将文件压缩为`.gz`格式。**
> 指定输出文件的格式为gzip。
> - `--format=xz`
> **将文件压缩为`.xz`格式。**
> 指定输出文件的格式为xz。
> - `--format=lzma`
> **将文件压缩为`.lzma`格式。**
> 指定输出文件的格式为LZMA。
>
> ### 高级解压缩选项
>
> - `-l`
> **打印有关Zstandard压缩文件的信息。**
> 显示压缩文件的元数据和压缩参数。
> - `--test`
> **测试压缩文件的完整性。**
> 验证压缩文件是否未损坏且完整。
> - `-M#`
> **将内存使用限制设置为#兆字节。**
> 限制解压缩过程中使用的内存量。
> - `[no-]sparse`
> **启用稀疏模式。** [默认:对文件启用,对STDOUT禁用]
> 在支持的文件系统中创建稀疏文件,节省存储空间。
> - `[no-]pass-through`
> **将未压缩的文件原样传递。** [默认:禁用]
> 对于未压缩的文件,直接传递而不进行任何处理。
>
> ### 字典构建器
>
> - `--train`
> **从训练文件集创建字典。**
> 使用指定的训练文件生成一个压缩字典。
> - `--train-cover[=k=#,d=#,steps=#,split=#,shrink[=#]]`
> **使用覆盖算法(带可选参数)。**
> 使用覆盖算法生成字典,可指定多个参数以优化字典性能。
> - `--train-fastcover[=k=#,d=#,f=#,steps=#,split=#,accel=#,shrink[=#]]`
> **使用快速覆盖算法(带可选参数)。**
> 使用快速覆盖算法生成字典,适用于需要快速生成字典的场景。
> - `--train-legacy[=s=#]`
> **使用选择度为#的旧版算法。** [默认:9]
> 使用传统的字典训练算法,适用于特定需求。
> - `-o NAME`
> **将字典命名为NAME。** [默认:dictionary]
> 指定生成的字典文件的名称。
> - `--maxdict=#`
> **将字典大小限制为#。** [默认:112640]
> 设置生成字典的最大大小,以字节为单位。
> - `--dictID=#`
> **强制字典ID为#。** [默认:随机]
> 为生成的字典指定一个固定的ID。
>
> ### 基准测试选项
>
> - `-b#`
> **使用压缩级别#进行基准测试。** [默认:3]
> 指定用于基准测试的压缩级别。
> - `-e#`
> **测试所有压缩级别,直到#;起始级别为`-b#`。** [默认:1]
> 对多个压缩级别进行基准测试,评估性能和压缩比。
> - `-i#`
> **将最小评估时间设置为#秒。** [默认:3]
> 指定每个压缩级别测试的最短运行时间。
> - `-B#`
> **将文件切割为大小为#的独立块。** [默认:不分块]
> 将输入文件分割成多个块,分别进行基准测试。
> - `-S`
> **为每个输入文件输出一个基准测试结果。** [默认:合并结果]
> 分别显示每个文件的基准测试结果,而非汇总。
> - `-D dictionary`
> **使用字典进行基准测试。**
> 在基准测试中使用指定的字典文件,评估字典对性能的影响。
> - `--priority=rt`
> **将进程优先级设置为实时。**
> 提高程序的优先级,以确保其在系统中获得更多资源
# WavPack
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ------- | ------ | ----------------------------------- | ---------- |
| WavPack | master | https://github.com/dbry/WavPack.git | 2025-02-08 |
## 编译过程
```shell
git clone https://github.com/dbry/WavPack.git
cd WavPack
apt install libtool gettext
./autogen.sh
CFLAGS="$CFLAGS -fno-sanitize=signed-integer-overflow" CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --disable-apps --disable-shared --enable-static
CFLAGS="$CFLAGS -fno-sanitize=signed-integer-overflow" make
cd fuzzing
vim ./target.cc //输入下面内容
/home/fuzz_dir/AFL/afl-g++ -std=c++17 -I ../include ./target.cc -o ./fuzzer_output /usr/local/lib/libwavpack.a -lpthread
```
**target.cc内容:**
```c
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "wavpack.h"
#ifdef __cplusplus
using namespace std;
#endif
#define BUF_SAMPLES 1024
typedef struct {
unsigned char ungetc_char, ungetc_flag;
unsigned char *sptr, *dptr, *eptr;
int64_t total_bytes_read;
} WavpackRawContext;
static int32_t raw_read_bytes (void *id, void *data, int32_t bcount)
{
WavpackRawContext *rcxt = (WavpackRawContext *) id;
unsigned char *outptr = (unsigned char *) data;
while (bcount) {
if (rcxt->ungetc_flag) {
*outptr++ = rcxt->ungetc_char;
rcxt->ungetc_flag = 0;
bcount--;
}
else {
size_t bytes_to_copy = rcxt->eptr - rcxt->dptr;
if (!bytes_to_copy)
break;
if (bytes_to_copy > bcount)
bytes_to_copy = bcount;
memcpy (outptr, rcxt->dptr, bytes_to_copy);
rcxt->total_bytes_read += bytes_to_copy;
rcxt->dptr += bytes_to_copy;
outptr += bytes_to_copy;
bcount -= bytes_to_copy;
}
}
return (int32_t)(outptr - (unsigned char *) data);
}
static int32_t raw_write_bytes (void *id, void *data, int32_t bcount)
{
return data ? bcount : 0;
}
static int64_t raw_get_pos (void *id)
{
WavpackRawContext *rcxt = (WavpackRawContext *) id;
return rcxt->dptr - rcxt->sptr;
}
static int raw_set_pos_abs (void *id, int64_t pos)
{
WavpackRawContext *rcxt = (WavpackRawContext *) id;
if (rcxt->sptr + pos < rcxt->sptr || rcxt->sptr + pos > rcxt->eptr)
return 1;
rcxt->dptr = rcxt->sptr + pos;
return 0;
}
static int raw_set_pos_rel (void *id, int64_t delta, int mode)
{
WavpackRawContext *rcxt = (WavpackRawContext *) id;
unsigned char *ref = NULL;
if (mode == SEEK_SET)
ref = rcxt->sptr;
else if (mode == SEEK_CUR)
ref = rcxt->dptr;
else if (mode == SEEK_END)
ref = rcxt->eptr;
if (ref + delta < rcxt->sptr || ref + delta > rcxt->eptr)
return 1;
rcxt->dptr = ref + delta;
return 0;
}
static int raw_push_back_byte (void *id, int c)
{
WavpackRawContext *rcxt = (WavpackRawContext *) id;
rcxt->ungetc_char = c;
rcxt->ungetc_flag = 1;
return c;
}
static int64_t raw_get_length (void *id)
{
WavpackRawContext *rcxt = (WavpackRawContext *) id;
return rcxt->eptr - rcxt->sptr;
}
static int raw_can_seek (void *id)
{
return 1;
}
static int raw_close_stream (void *id)
{
return 0;
}
static WavpackStreamReader64 raw_reader = {
raw_read_bytes, raw_write_bytes, raw_get_pos, raw_set_pos_abs, raw_set_pos_rel,
raw_push_back_byte, raw_get_length, raw_can_seek, NULL, raw_close_stream
};
static long long debug_log_mask = -1;
#ifdef __cplusplus
extern "C" int test_func(const uint8_t* data, size_t size)
#else
int test_func(const uint8_t* data, size_t size)
#endif
{
static long long times_called, opens, seeks, tag_writes, samples_decoded, text_tags, binary_tags;
int flags = OPEN_TAGS | OPEN_EDIT_TAGS | OPEN_WRAPPER | OPEN_DSD_AS_PCM | OPEN_NO_CHECKSUM | OPEN_NORMALIZE |
(4 << OPEN_THREADS_SHFT); // spin up 4 worker threads for better fuzz coverage
WavpackRawContext raw_wv;
WavpackContext *wpc;
char error [80];
int num_chans, bps, mode, qmode;
int64_t total_samples;
int retval = 0;
times_called++;
WavpackGetLibraryVersionString ();
WavpackGetLibraryVersion ();
memset (&raw_wv, 0, sizeof (WavpackRawContext));
raw_wv.dptr = raw_wv.sptr = (unsigned char *) data;
raw_wv.eptr = raw_wv.dptr + size;
wpc = WavpackOpenFileInputEx64 (&raw_reader, &raw_wv, NULL, error, flags, 15);
if (!wpc) {
retval = 1;
goto exit;
}
opens++;
num_chans = WavpackGetNumChannels (wpc);
total_samples = WavpackGetNumSamples64 (wpc);
bps = WavpackGetBytesPerSample (wpc);
qmode = WavpackGetQualifyMode (wpc);
mode = WavpackGetMode (wpc);
// call some other APIs for coverage
WavpackGetErrorMessage (wpc);
WavpackGetSampleIndex64 (wpc);
WavpackGetSampleIndex (wpc);
WavpackGetNumSamples (wpc);
WavpackGetNumErrors (wpc);
WavpackLossyBlocks (wpc);
WavpackGetProgress (wpc);
WavpackGetRatio (wpc);
WavpackGetAverageBitrate (wpc, 1);
WavpackGetInstantBitrate (wpc);
WavpackGetNativeSampleRate (wpc);
WavpackGetSampleRate (wpc);
WavpackGetChannelMask (wpc);
WavpackGetFloatNormExp (wpc);
WavpackGetBitsPerSample (wpc);
WavpackGetBytesPerSample (wpc);
WavpackGetReducedChannels (wpc);
WavpackGetVersion (wpc);
WavpackGetFileFormat (wpc);
WavpackGetFileExtension (wpc);
if (WavpackGetWrapperBytes (wpc))
WavpackGetWrapperData (wpc);
if (num_chans) {
unsigned char identities [num_chans + 1];
WavpackGetChannelIdentities (wpc, identities);
if (WavpackGetChannelLayout (wpc, NULL) & 0xff) {
unsigned char reordering [WavpackGetChannelLayout (wpc, NULL) & 0xff];
WavpackGetChannelLayout (wpc, reordering);
}
}
// Get all the metadata tags (text & binary)
if (mode & MODE_VALID_TAG) {
int num_binary_items = WavpackGetNumBinaryTagItems (wpc);
int num_items = WavpackGetNumTagItems (wpc), i;
for (i = 0; i < num_items; ++i) {
int item_len, value_len, j;
char *item, *value;
item_len = WavpackGetTagItemIndexed (wpc, i, NULL, 0);
item = (char *) malloc (item_len + 1);
WavpackGetTagItemIndexed (wpc, i, item, item_len + 1);
value_len = WavpackGetTagItem (wpc, item, NULL, 0);
value = (char *) malloc (value_len + 1);
WavpackGetTagItem (wpc, item, value, value_len + 1);
text_tags++;
free (value);
free (item);
}
for (i = 0; i < num_binary_items; ++i) {
int item_len, value_len;
char *item, *value;
item_len = WavpackGetBinaryTagItemIndexed (wpc, i, NULL, 0);
item = (char *) malloc (item_len + 1);
WavpackGetBinaryTagItemIndexed (wpc, i, item, item_len + 1);
value_len = WavpackGetBinaryTagItem (wpc, item, NULL, 0);
value = (char *) malloc (value_len);
WavpackGetBinaryTagItem (wpc, item, value, value_len);
binary_tags++;
free (value);
free (item);
}
WavpackAppendTagItem (wpc, "Artist", "The Googlers", strlen ("The Googlers"));
WavpackAppendTagItem (wpc, "Title", "Fuzz Me All Night Long", strlen ("Fuzz Me All Night Long"));
WavpackAppendTagItem (wpc, "Album", "Meet The Googlers", strlen ("Meet The Googlers"));
WavpackAppendBinaryTagItem (wpc, "Cover Art (Front)", (const char *) data, size < 4096 ? size : 4096);
}
// Decode all
if (num_chans && num_chans <= 256) {
int32_t decoded_samples [BUF_SAMPLES * num_chans];
unsigned char md5sum [16];
int unpack_result;
do {
unpack_result = WavpackUnpackSamples (wpc, decoded_samples, BUF_SAMPLES);
samples_decoded += unpack_result;
} while (unpack_result);
WavpackGetMD5Sum (wpc, md5sum);
}
// Seek to 1/3 of the way in plus 1000 samples (definitely not a block boundary)
if (WavpackSeekSample64 (wpc, total_samples / 3 + 1000)) {
++seeks;
// if we're still okay, try to write out the modified tags
if (WavpackWriteTag (wpc))
++tag_writes;
}
WavpackCloseFile (wpc);
exit:
if (!(times_called & debug_log_mask))
printf ("LLVMFuzzerTestOneInput(): %lld calls, %lld opens, %lld seeks, %lld tag writes, %lld samples, %lld text & %lld binary tags\n",
times_called, opens, seeks, tag_writes, samples_decoded, text_tags, binary_tags);
return retval;
}
int main(int argc, char *argv[]){
if(argc==1){
printf("%s\n", "usage");
return 0;
}
char* file_path = argv[1];
FILE *fp;
if((fp=fopen(file_path, "rb")) == NULL){
printf("cannot open file:%s\n", file_path);
return 0;
}
fseek(fp, 0, SEEK_END);
size_t file_len = ftell(fp);
uint8_t *tmp = (uint8_t*)malloc(sizeof(uint8_t) * file_len);
fseek(fp, 0, SEEK_SET);
fread(tmp, file_len, sizeof(uint8_t), fp);
fclose(fp);
test_func(tmp, file_len);
return 0;
}
```
## fuzz过程
```shell
unzip fuzzer_seed_corpus.zip
/home/fuzz_dir/AFL/afl-fuzz -i ./fuzzer_seed_corpus -o ./output ./fuzzer_output @@
#或者下面语句中的种子文件夹
/home/fuzz_dir/AFL/afl-fuzz -i ./regression/ -o ./output ./fuzzer_output @@
```
# lz4
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ---- | ------ | ------------------------------ | ---------- |
| lz4 | 1.10.0 | https://github.com/lz4/lz4.git | 2025-02-03 |
## 编译过程
```shell
git clone https://github.com/lz4/lz4.git
cd zstd
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ make -j 4
```
## fuzz过程
```shell
#压缩fuzz -k:保留源文件 --best:最高压缩率(可能牺牲速度)
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/others/text/ -o ./output ./programs/lz4 -k --best @@ /dev/null
#解压fuzz -d:解压 #参考链接:https://github.com/lz4/lz4/issues/738
mkdir input
./programs/lz4 /home/fuzz_dir/AFL/testcases/others/text/hello_world.txt -k ./inuput/hello_world.lz4
/home/fuzz_dir/AFL/afl-fuzz -i ./inuput -o ./output ./programs/lz4 -d @@ /dev/null
```
## 参数说明
> #### 基本参数
>
> - `-1`
> **快速压缩(默认)**
> 使用最快的压缩级别。
> - `-12`
> **最慢压缩级别**
> 使用最慢但压缩率最高的压缩级别。
> - `-T#`
> **使用 # 个线程进行压缩(默认:0=自动)**
> 指定并行压缩使用的线程数量。`0` 表示自动选择。
> - `-d`
> **解压缩(默认针对 `.lz4` 扩展名)**
> 对 `.lz4` 文件进行解压缩。
> - `-f`
> **无提示覆盖输出文件**
> 覆盖已存在的输出文件而不提示确认。
> - `-k`
> **保留源文件(默认)**
> 在压缩或解压缩后保留原始文件。
> - `--rm`
> **成功压缩/解压缩后删除源文件**
> 在确保压缩或解压缩成功后,删除源文件。
> - `-h/-H`
> **显示帮助/详细帮助并退出**
> `-h` 显示简短帮助,`-H` 显示详细帮助。
>
> #### 高级参数
>
> - `-V`
> **显示版本号并退出**
> 显示 `lz4` 的版本信息。
> - `-v`
> **详细模式**
> 显示详细的操作信息,有助于调试和监控。
> - `-q`
> **抑制警告;指定两次以抑制错误**
> 减少或隐藏警告信息,指定两次则同时隐藏错误信息。
> - `-c`
> **强制写入标准输出,即使输出是控制台**
> 将压缩或解压缩的数据输出到标准输出,即使输出目标是终端。
> - `-t`
> **测试压缩文件的完整性**
> 验证压缩文件是否未损坏。
> - `-m`
> **多输入文件(自动生成输出文件名)**
> 处理多个输入文件,并为每个文件生成相应的输出文件。
> - `-r`
> **递归处理目录(同时设置 `-m`)**
> 对指定目录及其所有子目录中的文件进行压缩或解压缩。
> - `-l`
> **使用旧版格式压缩(Linux 内核压缩)**
> 使用与 Linux 内核兼容的旧版压缩格式。
> - `-z`
> **强制压缩**
> 即使输入文件已经压缩,也强制进行压缩。
> - `-D FILE`
> **使用 FILE 作为字典(压缩和解压缩)**
> 指定一个字典文件,以提高压缩效率或兼容性。
> - `-B#`
> **将文件切分为大小为 # 字节的块 [32+]**
> 或使用预定义的块大小 [4-7](默认:7)。块大小影响压缩效率和性能。
> - `-BI`
> **块独立(默认)**
> 每个压缩块独立,不依赖其他块。
> - `-BD`
> **块依赖(提高压缩比)**
> 压缩块之间相互依赖,以提高整体压缩率。
> - `-BX`
> **启用块校验和(默认:禁用)**
> 为每个压缩块添加校验和,以检测数据完整性。
> - `--no-frame-crc`
> **禁用流校验和(默认:启用)**
> 不为整个压缩流添加校验和。
> - `--content-size`
> **压缩帧包含原始大小(默认:不包含)**
> 在压缩帧中包含原始数据的大小信息。
> - `--list FILE`
> **列出 .lz4 文件的信息(对使用 --content-size 标志压缩的文件有用)**
> 显示压缩文件的详细信息,如压缩前大小、压缩后大小等。
> - `--[no-]sparse`
> **稀疏模式(默认:文件启用,stdout 禁用)**
> 在支持稀疏文件的文件系统上,优化存储空间。
> - `--favor-decSpeed`
> **压缩文件解压更快,但压缩率较低**
> 优化压缩文件以便更快解压,但压缩率会有所降低。
> - `--fast[=#]`
> **切换到超快压缩级别(默认:1)**
> 使用更快的压缩速度,牺牲一定的压缩率。
> - `--best`
> **等同于 -12**
> 使用最高压缩级别。
>
> #### 基准测试参数
>
> - `-b#`
> **使用 # 压缩级别对文件进行基准测试(默认:1)**
> 对指定的文件使用特定的压缩级别进行压缩速度和压缩率的测试。
> - `-e#`
> **测试从 -bX 到 # 的所有压缩级别(默认:1)**
> 对一系列压缩级别进行基准测试,评估各级别的性能。
> - `-i#`
> **最小评估时间(秒)(默认:3秒)**
> 每个压缩级别的测试至少持续指定的时间,以确保结果的准确性。
>
> ### 示例
>
> 1. **压缩文件**
>
> ```bash
> lz4 -1 input.txt output.lz4
> ```
>
> 使用最快的压缩级别将 `input.txt` 压缩为 `output.lz4`。
>
> 2. **解压缩文件**
>
> ```bash
> lz4 -d output.lz4 decompressed.txt
> ```
>
> 解压缩 `output.lz4` 为 `decompressed.txt`。
>
> 3. **多文件压缩并保留源文件**
>
> ```bash
> lz4 -m -k *.txt
> ```
>
> 压缩当前目录下所有 `.txt` 文件,保留源文件。
>
> 4. **递归压缩目录**
>
> ```bash
> lz4 -r -k directory/
> ```
>
> 递归压缩 `directory/` 目录下的所有文件,保留源文件。
>
> 5. **使用字典进行压缩**
>
> ```bash
> lz4 -D mydict.lz4 input.txt compressed.lz4
> ```
>
> 使用 `mydict.lz4` 作为字典压缩 `input.txt`。
>
> 6. **基准测试**
>
> ```bash
> lz4 -b5 -i10 file.txt
> ```
>
> 使用压缩级别 5 对 `file.txt` 进行基准测试,每个级别测试至少持续 10 秒。
>
> ### 注意事项
>
> - 使用 `-f` 参数时要小心,以免意外覆盖重要文件。
> - 在处理大量文件或大文件时,适当调整 `-T#` 参数以优化性能。
> - 使用 `-D` 参数时,确保字典文件与压缩数据兼容。
# pcre2
**一个功能强大的正则表达式库,广泛用于文本匹配和处理。**
## 信息
| 名称 | 版本 | 源码地址 | 更新时间 |
| ----- | -------------------- | ------------------------------------- | ---------- |
| pcre2 | 10.46-DEV 2024-06-09 | https://github.com/PCRE2Project/pcre2 | 2025-02-17 |
## 编译过程
```shell
git clone https://github.com/PCRE2Project/pcre2
cd pcre2
./autogen.sh
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --disable-shared
make -j4
```
## fuzz过程
```shell
#-d:选项启用调试模式,显示匹配过程的详细信息
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/others/text/ -o ./output ./pcre2test -d @@ /dev/null
```
# libwebp
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| ------- | ----- | -------------------------------------- | ------------------------------------------------ | ---------- |
| libwebp | 1.5.0 | https://github.com/webmproject/libwebp | 开源的图像编解码库,专门用于处理 WebP 格式的图像 | 2025-01-30 |
## 编译过程
```shell
git clone https://github.com/webmproject/libwebp
cd libwebp
./autogen.sh
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --enable-shared=no --enable-static=no
make -j4
```
## fuzz过程
```shell
#将其他格式图片装转为webp格式 -m:指定压缩速度(0-6,0 最快但压缩率最低,6 最慢但压缩率最高) -q:指定压缩质量(0-100,默认 75)
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/png -o ./output ./examples/cwebp -m 6 -q 80 @@ -o /dev/null
#将webp格式图片装转为其他格式 -tiff:将WebP图像保存为未压缩的TIFF格式 -flip:将输出图像 垂直翻转 -mt:启用 多线程解码,提高解码速度
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/webp/ -o ./output ./examples/dwebp -tiff -flip -mt @@ -o /dev/null
```
# libvpx
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| ------ | ----- | ----------------------------------------- | ------------------------------------------------------------ | ---------- |
| libvpx | 1.5.0 | https://github.com/webmproject/libvpx.git | 开源的视频编解码器库,主要用于 VP8 和 VP9 视频格式的编码和解码 | 2025-02-05 |
## 编译过程
```shell
git clone https://github.com/webmproject/libvpx.git
cd libvpx
apt install yasm
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --enable-vp8 --enable-vp9 --enable-pic --enable-examples
make -j4
```
## fuzz过程
```shell
#vpxdec视频解码 需要.y4m格式的种子unifuzz上面有 --width --height :指定视频的分辨率 --codec:指定编码格式为 VP8(也可以是 vp9)
/home/fuzz_dir/AFL/afl-fuzz -m none -i ./*.y4m -o ./output ./vpxenc --width=640 --height=480 --codec=vp8 -o /dev/null @@
#vpxdec视频编码 需要webm格式的种子unifuzz上面有
/home/fuzz_dir/AFL/afl-fuzz -m none -i ./*.webm -o ./output ./vpxenc @@ -o /dev/null
```
# theora
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| ------ | ----- | --------------------------------------- | ---------------------------------------------------------- | ---------- |
| theora | 1.5.0 | https://gitlab.xiph.org/xiph/theora.git | 开源的视频编解码器,主要用于压缩和解压缩 Theora 格式的视频 | 2020-06-19 |
## 编译过程
```shell
git clone https://gitlab.xiph.org/xiph/theora.git
cd theora
apt install -y libogg-dev
./autogen.sh
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --enable-shared=no --enable-static=no
make -j4
```
## fuzz过程
```shell
#将tiff转为theora --chroma-444:使用 4:4:4 色度采样。-v:设置 Theora 视频质量,范围为 0 到 10
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/tiff/ -o ./output ./examples/tiff2theora -v 10 --chroma-444 @@ -o /dev/null
```
# minizip-ng
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| ---------- | ----- | ------------------------------------- | ------------- | ---------- |
| minizip-ng | 4.0.8 | https://github.com/zlib-ng/minizip-ng | 压缩/解压缩库 | 2025-01-09 |
## 编译过程
```shell
git clone https://github.com/zlib-ng/minizip-ng
cd minizip-ng
cmake -S . -B build -DMZ_BUILD_TESTS=ON -DCMAKE_C_COMPILER=/home/fuzz_dir/AFL/afl-gcc -DCMAKE_CXX_COMPILER=/home/fuzz_dir/AFL/afl-g++
cd build
make && make install
```
## fuzz过程
```shell
# -x:解压文件 -d:解压后文件存放文件夹
/home/fuzz_dir/AFL/afl-fuzz -i ../test/fuzz/unzip_fuzzer_seed_corpus/ -o ./output ./minizip -x -d /dev/null @@
```
# harfbuzz
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| -------- | ------ | ---------------------------------------- | -------- | ---------- |
| harfbuzz | 10.1.0 | https://github.com/harfbuzz/harfbuzz.git | 字体工具 | 2025-02-19 |
## 编译过程
```shell
git clone https://github.com/harfbuzz/harfbuzz.git
cd harfbuzz
apt install meson
pip3 install --upgrade meson #升级最新的 编译对版本有要求
export CC=/home/fuzz_dir/AFL/afl-gcc && export CXX=/home/fuzz_dir/AFL/afl-g++
meson setup build
meson compile -C build
```
## fuzz过程
```shell
#文本整形
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/others/text/ -o output ./build/util/hb-shape --font-file=./test/api/fonts/TestGVAREight.ttf --text-file=@@
#可视化文本整形
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/others/text/ -o output ./build/util/hb-view --font-file=./test/api/fonts/TestGVAREight.ttf --text-file=@@
```
## 参数说明
### hb-shape
> ### 帮助选项
>
> - `-h, --help`:显示基本帮助选项。
> - `--help-all`:显示所有帮助选项。
> - `--help-face`:显示字体相关的选项。
> - `--help-font`:显示字体实例相关的选项。
> - `--help-variations`:显示字体变体相关的选项。
> - `--help-text`:显示输入文本相关的选项。
> - `--help-text-context`:显示文本上下文相关的选项。
> - `--help-shape`:显示形状处理相关的选项。
> - `--help-features`:显示字体特性相关的选项。
> - `--help-output`:显示输出相关的选项。
> - `--help-output-syntax`:显示输出语法相关的选项。
>
> ### 字体面选项
>
> - `--font-file=filename`:设置字体文件名。
> - `-y, --face-index=index`:设置字体面索引(默认:0)。
> - `--face-loader=loader`:设置字体面加载器(默认:ot)。支持的加载器有 `ot` 和 `ft`。
>
> ### 字体实例选项
>
> - `--font-size=1/2 integers or 'upem'`:设置字体大小(默认:upem)。
> - `--font-ppem=1/2 integers`:设置每 EM 的像素数(默认:0;禁用)。
> - `--font-ptem=point-size`:设置字体点大小(默认:0;禁用)。
> - `--font-bold=1/2 numbers; eg. 0.05`:设置合成粗体(默认:0)。
> - `--font-grade=1/2 numbers; eg. 0.05`:设置合成字重(默认:0)。
> - `--font-slant=slant ratio; eg. 0.2`:设置合成斜体(默认:0)。
> - `--font-funcs=impl`:设置字体函数实现(默认:ot)。支持的实现有 `ot` 和 `ft`。
> - `--ft-load-flags=integer`:设置 FreeType 加载标志(默认:2)。
>
> ### 变体选项
>
> - `--named-instance=index`:设置命名实例索引(默认:无)。
> - `--variations=list`:设置字体变体。变体是全局设置的,格式为 `标签=值`,例如 `"wght=500"`。
>
> ### 文本选项
>
> - `--text=string`:设置输入文本。
> - `--text-file=filename`:设置输入文本文件名。
> - `-u, --unicodes=list of hex numbers`:设置输入 Unicode 码点。
> - `--single-par`:将文本视为单个段落。
>
> ### 文本上下文选项
>
> - `--text-before=string`:设置每行文本之前的上下文。
> - `--text-after=string`:设置每行文本之后的上下文。
> - `--unicodes-before=list of hex numbers`:设置每行文本之前的 Unicode 码点上下文。
> - `--unicodes-after=list of hex numbers`:设置每行文本之后的 Unicode 码点上下文。
>
> ### 形状处理选项
>
> - `--list-shapers`:列出可用的形状处理器并退出。
> - `--shapers=list`:设置要尝试的形状处理器列表。
> - `--direction=ltr/rtl/ttb/btt`:设置文本方向(默认:自动)。
> - `--language=BCP 47 tag`:设置文本语言(默认:`$LANG`)。
> - `--script=ISO-15924 tag`:设置文本脚本(默认:自动)。
> - `--bot`:将文本视为段落开头。
> - `--eot`:将文本视为段落结尾。
> - `--preserve-default-ignorables`:保留默认忽略字符。
> - `--remove-default-ignorables`:移除默认忽略字符。
> - `--invisible-glyph`:设置替换默认忽略字符的 glyph 值。
> - `--not-found-glyph`:设置替换未找到字符的 glyph 值。
> - `--not-found-variation-selector-glyph`:设置替换未找到变体选择符字符的 glyph 值。
> - `--utf8-clusters`:使用 UTF8 字节索引,而不是字符索引。
> - `--cluster-level=0/1/2`:设置簇合并级别(默认:0)。
> - `--normalize-glyphs`:重新排列 glyph 簇为名义顺序。
> - `--unsafe-to-concat`:生成不可连接的 glyph 标志。
> - `--safe-to-insert-tatweel`:生成可插入 tatweel 的 glyph 标志。
> - `--glyphs`:将输入解释为 glyph 字符串。
> - `--verify`:对形状处理结果进行完整性检查。
>
> ### 字体特性选项
>
> - `--features=list`:设置字体特性列表。特性可以全局启用或禁用,也可以限定在特定字符范围内。格式为 `标签=值`,例如 `"kern=1"`。
>
> ### 输出目标与格式选项
>
> - `-o, --output-file=filename`:设置输出文件名(默认:标准输出)。
> - `-O, --output-format=format`:设置输出格式。支持的格式有 `text` 和 `json`。
>
> ### 输出语法选项
>
> - `--show-text`:在每行输出前加上对应的输入文本。
> - `--show-unicode`:在每行输出前加上对应的输入码点。
> - `--show-line-num`:在每行输出前加上对应的输入行号。
> - `-v, --verbose`:在每行输出前加上所有上述信息。
> - `--no-glyph-names`:输出 glyph 索引而不是名称。
> - `--no-positions`:不输出 glyph 位置。
> - `--no-advances`:不输出 glyph 前进量。
> - `--no-clusters`:不输出簇索引。
> - `--show-extents`:输出 glyph 范围。
> - `--show-flags`:输出 glyph 标志。
> - `--ned`:不输出额外数据;不输出簇或前进量。
> - `-V, --trace`:输出中间形状处理结果。
>
> ### 应用程序选项
>
> - `--version`:显示版本号。
> - `-n, --num-iterations=N`:运行形状处理器 N 次(默认:1)。
# libjpeg-turbo
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| ------------- | ------ | -------------------------------------------------- | ---------------- | ---------- |
| libjpeg-turbo | 10.1.0 | https://github.com/libjpeg-turbo/libjpeg-turbo.git | JPEG图像编解码器 | 2025-02-18 |
## 编译过程
```shell
git clone https://github.com/libjpeg-turbo/libjpeg-turbo.git
cd libjpeg-turbo
cmake -S . -B build -DMZ_BUILD_TESTS=ON -DCMAKE_C_COMPILER=/home/fuzz_dir/AFL/afl-gcc -DCMAKE_CXX_COMPILER=/home/fuzz_dir/AFL/afl-g++
cd build
make -j4
#可执行程序,build/cjpeg、djpeg
```
## fuzz过程
```shell
#压缩图像为JPEG
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/bmp/ -o ./output ./cjpeg -rgb -optimize -progressive -arithmetic -smooth 50 -dct fast -outfile /dev/null @@
#参考链接:https://github.com/libjpeg-turbo/libjpeg-turbo/issues/633
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/bmp/ -o ./output ./cjpeg -precision 12 -outfile /dev/null @@
#解压缩JPEG图像
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/jpeg/ -o ./output ./djpeg -dct float -gif -outfile /dev/null @@
#参考链接:https://github.com/libjpeg-turbo/libjpeg-turbo/issues/690
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/jpeg/ -o ./output ./djpeg -fast -outfile /dev/null @@
#参考链接:https://github.com/libjpeg-turbo/libjpeg-turbo/issues/675
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/jpeg/ -o ./output ./djpeg -nosmooth -outfile /dev/null @@
#参考链接:https://github.com/libjpeg-turbo/libjpeg-turbo/issues/670
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/jpeg/ -o ./output ./djpeg -nosmooth -memsrc -outfile /dev/null @@
#参考链接:https://github.com/libjpeg-turbo/libjpeg-turbo/issues/677
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/jpeg/ -o ./output ./djpeg -gif -onepass -outfile /dev/null @@
#参考链接:https://github.com/libjpeg-turbo/libjpeg-turbo/issues/543
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/jpeg/ -o ./output ./jpegtran-static -outfile /dev/null @@
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/jpeg/ -o ./output ./jpegtran -outfile /dev/null @@
```
## 参数说明
### cjpeg
> ### **基础参数**
>
> 1. **`-quality N[,...]`**
> - 压缩质量,范围 `0-100`(默认 `75`)。
> - 值越高,画质越好但文件越大;建议范围 `5-95`。
> - 多组件格式(如 `-quality 80,90,70`)可分别设置 Y/Cb/Cr 通道的质量。
> 2. **`-grayscale`**
> - 生成灰度(黑白)JPEG 文件,仅保留亮度(Y)通道。
> 3. **`-rgb`**
> - 生成 RGB 色彩模式的 JPEG 文件(非标准格式,某些软件可能不支持)。
> 4. **`-optimize`**
> - 优化霍夫曼编码表,生成更小的文件,但压缩速度变慢。
> 5. **`-progressive`**
> - 生成渐进式 JPEG 文件(图片从模糊到清晰逐步加载)。
> 6. **`-targa`**
> - 指定输入文件为 Targa 格式(`.tga`,通常无需手动指定,工具会自动检测)。
> 7. **`-outfile name`**
> - 指定输出文件名(默认输出到标准输出)。
> - 示例:`./cjpeg -outfile output.jpg input.ppm`
>
> ------
>
> ### **高级参数**
>
> 1. **`-precision N`**
> - 设置 JPEG 数据精度位数(`N=2-16`,默认 `8`)。
> - 若 `N` 非 `8` 或 `12`,必须同时使用 `-lossless` 参数。
> 2. **`-lossless psv[,Pt]`**
> - 生成无损 JPEG 文件(需搭配 `-precision` 指定精度)。
> - `psv` 是预测器选择值,`Pt` 是点变换参数(具体需参考 JPEG 无损标准)。
> 3. **`-arithmetic`**
> - 使用算术编码(生成更小文件,但部分解码器不支持)。
> 4. **`-dct int | fast | float`**
> - 选择离散余弦变换(DCT)方法:
> - `int`:精确整数 DCT(默认)
> - `fast`:快速整数 DCT(兼容旧版,精度较低)
> - `float`:浮点 DCT(遗留功能,可能不兼容)
> 5. **`-icc FILE`**
> - 嵌入指定文件中的 ICC 色彩配置文件。
> 6. **`-restart N`**
> - 设置重启间隔(单位:行数或块数,如 `10B` 表示每 10 个块插入重启标记)。
> 7. **`-smooth N`**
> - 对输入图像进行平滑处理(`N=1-100`,值越大平滑强度越高)。
> 8. **`-maxmemory N`**
> - 限制最大内存使用量(单位:KB)。
> 9. **`-memdst`**
> - 压缩到内存而非文件(用于性能测试)。
>
> ------
>
> ### **调试与信息**
>
> 1. **`-report`**
> - 显示压缩进度报告。
> 2. **`-strict`**
> - 将所有警告视为致命错误(严格模式)。
> 3. **`-verbose` 或 `-debug`**
> - 输出详细调试信息。
> 4. **`-version`**
> - 显示版本信息并退出。
>
> ------
>
> ### **专家级参数**
>
> 1. **`-baseline`**
> - 强制使用基准量化表(兼容性优先)。
> 2. **`-qtables FILE`**
> - 从文件加载自定义量化表(格式需符合规范)。
> 3. **`-qslots N[,...]`**
> - 为每个颜色分量指定量化表 ID(如 `-qslots 0,1,1` 对应 Y/Cb/Cr)。
> 4. **`-sample HxV[,...]`**
> - 设置颜色分量的采样因子(如 `-sample 2x2,1x1,1x1` 表示 YUV 4:2:0)。
> 5. **`-scans FILE`**
> - 根据脚本文件生成多扫描(multi-scan)JPEG(用于渐进式编码优化)。
### djpeg
> ### **基础参数**
>
> 1. **`-colors N`**
> - 将图像颜色减少到不超过 `N` 种(遗留功能,用于低色深输出)。
> 2. **`-fast`**
> - 启用快速处理模式(牺牲质量以提高速度,遗留功能)。
> 3. **`-grayscale`**
> - 强制输出灰度图像(黑白)。
> 4. **`-rgb`**
> - 强制输出 RGB 色彩模式的图像。
> 5. **`-rgb565`**
> - 强制输出 RGB565 格式的图像(16 位色彩,常用于嵌入式设备)。
> 6. **`-scale M/N`**
> - 按比例 `M/N` 缩放输出图像(如 `1/8` 表示缩小到原图的 1/8)。
> 7. **`-bmp`**
> - 选择 BMP 输出格式(Windows 风格)。
> 8. **`-gif`**
> - 选择 GIF 输出格式(LZW 压缩,遗留功能)。
> 9. **`-gif0`**
> - 选择 GIF 输出格式(未压缩,遗留功能)。
> 10. **`-os2`**
> - 选择 BMP 输出格式(OS/2 风格,遗留功能)。
> 11. **`-pnm`**
> - 选择 PBMPLUS(PPM/PGM)输出格式(默认)。
> 12. **`-targa`**
> - 选择 Targa 输出格式(遗留功能)。
>
> ------
>
> ### **高级参数**
>
> 1. **`-dct int | fast | float`**
> - 选择离散余弦变换(DCT)方法:
> - `int`:精确整数 DCT(默认)
> - `fast`:快速整数 DCT(遗留功能,精度较低)
> - `float`:浮点 DCT(遗留功能,可能不兼容)
> 2. **`-dither fs | none | ordered`**
> - 选择颜色量化时的抖动方法:
> - `fs`:Floyd-Steinberg 抖动(默认)
> - `none`:不使用抖动
> - `ordered`:使用有序抖动
> 3. **`-icc FILE`**
> - 将 ICC 色彩配置文件提取到指定文件。
> 4. **`-map FILE`**
> - 使用指定图像文件中的颜色进行量化(遗留功能)。
> 5. **`-nosmooth`**
> - 使用更快但质量较低的上采样方法。
> 6. **`-onepass`**
> - 使用单次颜色量化(低质量,遗留功能)。
> 7. **`-maxmemory N`**
> - 限制最大内存使用量(单位:KB)。
> 8. **`-maxscans N`**
> - 限制输入文件中的最大扫描次数。
> 9. **`-outfile name`**
> - 指定输出文件名(默认输出到标准输出)。
> - 示例:`./djpeg -outfile output.ppm input.jpg`
> 10. **`-memsrc`**
> - 在解压缩前将输入文件加载到内存中。
> 11. **`-report`**
> - 显示解压缩进度报告。
> 12. **`-skip Y0,Y1`**
> - 跳过从 `Y0` 到 `Y1` 的行(不处理这些行)。
> 13. **`-crop WxH+X+Y`**
> - 仅解压缩图像的矩形区域(需搭配 PBMPLUS、GIF 或 Targa 输出格式)。
> - 示例:`-crop 100x100+10+10` 表示从坐标 (10,10) 开始裁剪 100x100 的区域。
>
> ------
>
> ### **调试与信息**
>
> 1. **`-strict`**
> - 将所有警告视为致命错误(严格模式)。
> 2. **`-verbose` 或 `-debug`**
> - 输出详细调试信息。
> 3. **`-version`**
> - 显示版本信息并退出。
### jpegtran-static
> ### **基础参数**
>
> 1. **`-copy none | comments | icc | all`**
> - 控制从源文件复制额外标记的行为:
> - `none`:不复制任何额外标记。
> - `comments`:仅复制注释标记(默认)。
> - `icc`:仅复制 ICC 配置文件标记。
> - `all`:复制所有额外标记。
> 2. **`-optimize`**
> - 优化霍夫曼编码表,生成更小的文件,但压缩速度变慢。
> 3. **`-progressive`**
> - 生成渐进式 JPEG 文件(图片从模糊到清晰逐步加载)。
>
> ------
>
> ### **图像修改参数**
>
> 1. **`-crop WxH+X+Y`**
> - 裁剪图像的矩形区域。
> - 示例:`-crop 200x100+50+30` 表示从坐标 (50,30) 开始裁剪 200x100 的区域。
> 2. **`-drop +X+Y filename`**
> - 在指定位置插入另一张图像。
> - 示例:`-drop +10+20 insert.jpg` 表示在坐标 (10,20) 插入 `insert.jpg`。
> 3. **`-flip [horizontal|vertical]`**
> - 镜像翻转图像:
> - `horizontal`:水平翻转(左右镜像)。
> - `vertical`:垂直翻转(上下镜像)。
> 4. **`-grayscale`**
> - 将图像转换为灰度图(去除颜色数据)。
> 5. **`-perfect`**
> - 如果存在无法转换的边缘块,则报错退出。
> 6. **`-rotate [90|180|270]`**
> - 顺时针旋转图像:
> - `90`:旋转 90 度。
> - `180`:旋转 180 度。
> - `270`:旋转 270 度。
> 7. **`-transpose`**
> - 转置图像(行列互换)。
> 8. **`-transverse`**
> - 横向转置图像(转置后再水平翻转)。
> 9. **`-trim`**
> - 删除无法转换的边缘块。
> - 与 `-drop` 一起使用时,重新量化插入图像以匹配源文件。
> 10. **`-wipe WxH+X+Y`**
> - 将指定矩形区域涂灰。
> - 示例:`-wipe 100x50+20+10` 表示从坐标 (20,10) 开始涂灰 100x50 的区域。
>
> ------
>
> ### **高级参数**
>
> 1. **`-arithmetic`**
> - 使用算术编码(生成更小文件,但部分解码器不支持)。
> 2. **`-icc FILE`**
> - 嵌入指定文件中的 ICC 色彩配置文件。
> 3. **`-restart N`**
> - 设置重启间隔(单位:行数或块数,如 `10B` 表示每 10 个块插入重启标记)。
> 4. **`-maxmemory N`**
> - 限制最大内存使用量(单位:KB)。
> 5. **`-maxscans N`**
> - 限制输入文件中的最大扫描次数。
> 6. **`-outfile name`**
> - 指定输出文件名(默认输出到标准输出)。
> - 示例:`-outfile output.jpg input.jpg`
> 7. **`-report`**
> - 显示转换进度报告。
> 8. **`-strict`**
> - 将所有警告视为致命错误(严格模式)。
> 9. **`-verbose` 或 `-debug`**
> - 输出详细调试信息。
> 10. **`-version`**
> - 显示版本信息并退出。
>
> ------
>
> ### **专家级参数**
>
> 1. `-scans FILE`
> - 根据脚本文件生成多扫描(multi-scan)JPEG(用于渐进式编码优化)。
# speex
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| ----- | ----- | -------------------------------------- | ------------ | ---------- |
| speex | 1.2.1 | https://gitlab.xiph.org/xiph/speex.git | 音频编解码器 | 2025-02-18 |
## 编译过程
```shell
git clone https://gitlab.xiph.org/xiph/speex.git
cd speex
./autogen.sh
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --enable-shared=no --enable-static=no
make -j4
#可执行程序在src目录下:speexenc、speexdec
cd src
```
## fuzz过程
```shell
#speexdec:解码Speex文件并将其转换为WAV,unifuzz上面有测试用例.spx
/home/fuzz_dir/AFL/afl-fuzz -i ./*.spx -o ../dec_output ./speexdec --packet-loss 10 --stereo @@ /dev/null
#speexenc:将音频文件编码为Speex格式
/home/fuzz./aut _dir/AFL/afl-fuzz -i ./*.spx -o ../enc_output ./speexenc --quality 0 --bitrate 4 --vbr --denoise --agc --vad --comp 10 --16bit @@ /dev/null
```
## 参数说明
### speexdec
> - ### **输入文件**
>
> - `input_file`
>
> :输入文件可以是以下形式:
>
> - `filename.spx`:常规的 Speex 文件。
> - `-`:从标准输入(stdin)读取数据。
>
> ------
>
> ### **输出文件**
>
> - `output_file`
>
> :输出文件可以是以下形式:
>
> - `filename.wav`:生成 WAV 文件。
> - `filename.*`:生成原始 PCM 文件(扩展名不是 `.wav` 的文件)。
> - `-`:输出到标准输出(stdout)。
> - (不指定):直接播放到声卡。
>
> ------
>
> ### **选项**
>
> - `--enh`
>
> :启用感知增强(默认启用)。
>
> - 感知增强可以提高解码后的音频质量,尤其是对语音信号。
>
> - **`--no-enh`**:禁用感知增强。
>
> - `--force-nb`
>
> :强制以窄带(Narrowband)模式解码。
>
> - 窄带模式适用于 8 kHz 采样率的语音。
>
> - `--force-wb`
>
> :强制以宽带(Wideband)模式解码。
>
> - 宽带模式适用于 16 kHz 采样率的语音。
>
> - `--force-uwb`
>
> :强制以超宽带(Ultra-Wideband)模式解码。
>
> - 超宽带模式适用于 32 kHz 采样率的语音。
>
> - **`--mono`**:强制以单声道(Mono)模式解码。
>
> - **`--stereo`**:强制以立体声(Stereo)模式解码。
>
> - `--rate n`:强制以指定的采样率
>
> - 例如:`--rate 16000` 表示以 16 kHz 采样率解码。
>
> - `--packet-loss n`:模拟`n%`的随机丢包。
>
> - 用于测试解码器在丢包情况下的表现。
>
> - **`-V`**:启用详细模式,显示比特率信息。
>
> - **`-h, --help`**:显示帮助信息。
>
> - **`-v, --version`**:显示版本信息。
>
> - **`--pf`**:已弃用,改用 `--enh`。
>
> - **`--no-pf`**:已弃用,改用 `--no-enh`。
### speexenc
> 这是一个用于将音频文件编码为 **Speex** 格式的命令行工具。以下是各部分的详细中文解释:
>
> ------
>
> ### **输入文件**
>
> - `input_file`
>
> :输入文件可以是以下形式:
>
> - `filename.wav`:WAV 文件。
> - `filename.*`:原始 PCM 文件(扩展名不是 `.wav` 的文件)。
> - `-`:从标准输入(stdin)读取数据。
>
> ------
>
> ### **输出文件**
>
> - `output_file`
>
> :输出文件可以是以下形式:
>
> - `filename.spx`:生成的 Speex 文件。
> - `-`:输出到标准输出(stdout)。
>
> ------
>
> ### **选项**
>
> #### **编码模式**
>
> - **`-n, --narrowband`**:将输入文件视为窄带(8 kHz)。
> - **`-w, --wideband`**:将输入文件视为宽带(16 kHz)。
> - **`-u, --ultra-wideband`**:将输入文件视为超宽带(32 kHz)。
>
> #### **编码质量**
>
> - `--quality n`
>
> :设置编码质量(0-10),默认值为 8。
>
> - 值越高,质量越好,但文件越大。
>
> - **`--bitrate n`**:设置编码比特率(使用 `n` 或更低的比特率)。
>
> - `--vbr`
>
> :启用可变比特率(VBR)。
>
> - VBR 根据音频内容的复杂度动态调整比特率。
>
> - **`--vbr-max-bitrate`**:设置 VBR 的最大允许比特率。
>
> - **`--abr rate`**:启用平均比特率(ABR),并设置目标比特率(单位:bps)。
>
> - `--vad`
>
> :启用语音活动检测(VAD)。
>
> - VAD 可以检测静音部分并减少其比特率。
>
> - `--dtx`
>
> :启用基于文件的不连续传输(DTX)。
>
> - DTX 在静音部分停止传输数据以节省带宽。
>
> #### **编码复杂度**
>
> - `--comp n`
>
> :设置编码复杂度(0-10),默认值为 3。
>
> - 值越高,编码质量越好,但计算资源消耗越大。
>
> #### **Ogg 封装**
>
> - **`--nframes n`**:设置每个 Ogg 数据包中的帧数(1-10),默认值为 1。
> - **`--skeleton`**:输出 Ogg Skeleton 元数据(可能导致兼容性问题)。
>
> #### **音频处理**
>
> - **`--denoise`**:在编码前对输入音频进行降噪处理。
> - **`--agc`**:在编码前应用自适应增益控制(AGC)。
> - **`--no-highpass`**:禁用编码器内置的高通滤波器。
>
> #### **元数据**
>
> - `--comment`
>
> :添加额外的注释信息。可以多次使用。
>
> - 例如:`--comment "Recorded on 2023-10-01"`。
>
> - **`--author`**:设置音轨的作者信息。
>
> - **`--title`**:设置音轨的标题信息。
>
> #### **其他选项**
>
> - **`-h, --help`**:显示帮助信息。
> - **`-v, --version`**:显示版本信息。
> - **`-V`**:启用详细模式,显示比特率信息。
> - **`--print-rate`**:将每帧的比特率打印到标准输出。
>
> ------
>
> ### **原始 PCM 输入选项**
>
> - **`--rate n`**:设置原始 PCM 输入的采样率。
> - **`--stereo`**:将原始 PCM 输入视为立体声。
> - **`--le`**:原始 PCM 输入为小端序(Little-Endian)。
> - **`--be`**:原始 PCM 输入为大端序(Big-Endian)。
> - **`--8bit`**:原始 PCM 输入为 8 位无符号格式。
> - **`--16bit`**:原始 PCM 输入为 16 位有符号格式。
>
> **默认值**:原始 PCM 输入为 16 位、小端序、单声道。
# nettle
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| ------ | ------ | ---------------------------------------- | ---------------- | ---------- |
| nettle | 3.10.1 | https://git.lysator.liu.se/nettle/nettle | 用于加密的低级库 | 2025-02-10 |
## 编译过程
```shell
git clone https://git.lysator.liu.se/nettle/nettle
cd nettle
apt install texlive -y
autoreconf -ivf
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --disable-shared
make -j4
#可执行程序:/tools/nettle-hash
cd tools
```
## fuzz过程
```shell
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/others/text/ -o ./output ./nettle-hash -a sha256 @@
```
## 参数说明
> ### **选项**
>
> #### **帮助与信息**
>
> - **`--help`**:显示帮助信息。
> - **`-V, --version`**:显示版本信息。
> - **`--list`**:列出支持的哈希算法。
>
> #### **哈希算法**
>
> - `-a, --algorithm=ALG`
>
> :指定要使用的哈希算法。
>
> - 例如:`-a md5`、`-a sha256` 等。
> - 支持的算法可以通过 `--list` 查看。
>
> #### **输出控制**
>
> - `-l, --length=LENGTH`
>
> :指定哈希值的长度(以字节为单位)。
>
> - 仅适用于支持可变长度输出的哈希算法(如 SHAKE256)。
>
> - `--raw`
>
> :以原始二进制格式输出哈希值。
>
> - 默认情况下,哈希值以十六进制字符串形式输出。
# lcms2
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| ----- | ---- | ------------------------------------- | -------------- | ---------- |
| lcms2 | 2.17 | https://github.com/mm2/Little-CMS.git | 颜色管理系统库 | 2025-02-17 |
## 编译过程
```shell
git clone https://github.com/mm2/Little-CMS.git
cd Little-CMS
./autogen.sh
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --enable-shared=no --enable-static=no
make -j4
#可执行程序:little-cms/utils/jpgicc/jpgicc
cd utils/jpgicc/
```
## fuzz过程
```shell
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/images/jpeg/ -o ./output ./jpgicc @@ /dev/null
```
## 参数说明
> ### **基本用法**
>
> ```bash
> jpgicc [flags] input.jpg output.jpg
> ```
>
> - **`input.jpg`**:输入的 JPEG 文件。
> - **`output.jpg`**:输出的 JPEG 文件。
>
> ------
>
> ### **选项**
>
> #### **输入与输出配置文件**
>
> - **`-i<profile>`**:指定输入文件的 ICC 配置文件(默认:sRGB)。
> - **`-o<profile>`**:指定输出文件的 ICC 配置文件(默认:sRGB)。
>
> #### **内置配置文件**
>
> Little-CMS 提供了一些内置的 ICC 配置文件,可以直接使用:
>
> - **`\*Lab2`**:基于 D50 的 v2 CIEL*a*b。
> - **`\*Lab4`**:基于 D50 的 v4 CIEL*a*b。
> - **`\*Lab`**:基于 D50 的 v4 CIEL*a*b。
> - **`\*XYZ`**:CIE XYZ(PCS)。
> - **`\*sRGB`**:sRGB 色彩空间。
> - **`\*Gray22`**:Gamma 2.2 的单色(灰度)。
> - **`\*Gray30`**:Gamma 3.0 的单色(灰度)。
> - **`\*null`**:将所有输入视为单色黑色。
> - **`\*Lin2222`**:CMYK 线性化,每个通道的 Gamma 为 2.2。
>
> #### **渲染意图**
>
> - `-t<n>`
>
> :指定渲染意图(Rendering Intent),`n`的取值如下:
>
> - `0`:感知(Perceptual)。
> - `1`:相对色度(Relative Colorimetric)。
> - `2`:饱和度(Saturation)。
> - `3`:绝对色度(Absolute Colorimetric)。
> - `10`:保留黑色墨水的感知。
> - `11`:保留黑色墨水的相对色度。
> - `12`:保留黑色墨水的饱和度。
> - `13`:保留黑色平面的感知。
> - `14`:保留黑色平面的相对色度。
> - `15`:保留黑色平面的饱和度。
>
> #### **其他选项**
>
> - **`-b`**:启用黑点补偿(Black Point Compensation)。
> - **`-d<0..1>`**:设置观察者适应状态(仅适用于绝对色度)。
> - **`-n`**:忽略输入文件中的嵌入配置文件。
> - **`-e`**:在输出文件中嵌入目标配置文件。
> - **`-s<new profile>`**:将嵌入的配置文件保存为 `<new profile>`。
> - **`-c<0,1,2,3>`**:预计算转换(`0`=关闭,`1`=正常,`2`=高分辨率,`3`=低分辨率,默认:1)。
>
> #### **软打样(Soft Proofing)**
>
> - **`-p<profile>`**:指定软打样配置文件。
> - **`-m<0,1,2,3>`**:指定软打样的渲染意图。
> - **`-g`**:在软打样中标记超出色域的颜色。
> - **`-!<r>,<g>,<b>`**:设置超出色域标记的颜色值(RGB 格式)。
>
> #### **JPEG 输出质量**
>
> - **`-q<0..100>`**:设置输出 JPEG 文件的质量(0-100,默认:75)。
>
> #### **信息与帮助**
>
> - **`-v`**:启用详细模式,显示更多信息。
> - **`-h`**:显示帮助信息。
# libyaml
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| ------- | ---- | ----------------------------------- | --------------- | ---------- |
| libyaml | 2.17 | https://github.com/yaml/libyaml.git | 解析和发出 YAML | 2024-05-20 |
## 编译过程
```shell
git clone https://github.com/yaml/libyaml.git
cd libyaml
./bootstrap
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --disable-shared
make -j4
#可执行程序:/tests/run-scanner、run-dumper、run-emitter、run-loader、run-parser
cd ./tests
```
## fuzz过程
```shell
/home/fuzz_dir/AFL/afl-fuzz -i /home/lingzhen/code/libyaml/examples/ -o ./output ./run-scanner @@ /dev/null
```
## 参数说明
# libtasn1
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| -------- | -------- | -------------------------------------- | ------------------------------------- | ---------- |
| libtasn1 | 4.20.0.7 | https://gitlab.com/gnutls/libtasn1.git | ASN.1(抽象语法标记法)编码和解码的库 | 2025-02-21 |
## 编译过程
```shell
git clone https://gitlab.com/gnutls/libtasn1.git
apt install make git autoconf automake libtool bison texinfo help2man gtk-doc-tools valgrind abigail-tools
cd libtasn1
./bootstrap
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --disable-shared
make -j4
#可执行程序:/tests/run-scanner、run-dumper、run-emitter、run-loader、run-parser
cd ./tests
```
## fuzz过程
```shell
/home/fuzz_dir/AFL/afl-fuzz -i /home/lingzhen/code/libtasn1/tests/ -o ./output ./src/asn1Parser -c @@ -o /dev/null
```
## 参数说明
### asn1Parser
> ### **选项**
>
> #### **语法检查**
>
> - **`-c, --check`**:仅检查 ASN.1 文件的语法,不生成输出文件。
>
> #### **输出文件**
>
> - `-o, --output=FILE`
>
> :指定输出文件。
>
> - 如果不指定输出文件,则结果会打印到标准输出。
>
> #### **数组名称**
>
> - `-n, --name=NAME`
>
> :指定生成的 C 数组的名称。
>
> - 默认情况下,数组名称可能基于输入文件名或默认值。
>
> #### **帮助与版本**
>
> - **`-h, --help`**:显示帮助信息并退出。
> - **`-v, --version`**:显示版本信息并退出。
# libsodium
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| --------- | ------ | ----------------------------------------- | ---------------------------------- | ---------- |
| libsodium | master | https://github.com/jedisct1/libsodium.git | 用于加密、解密、签名、密码哈希处理 | 2025-02-21 |
## 编译过程
```shell
git clone https://github.com/jedisct1/libsodium.git
cd libsodium
autoconf && autoreconf -ivf
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure --disable-shared
make -j4
vim libsodium_target.cc #内容参考下方
/home/fuzz_dir/AFL/afl-gcc -I ./src/libsodium/include/ -L ./src/libsodium/.libs/ ./target.cc -o libsodium_target -lsodium
```
```c++
// Copyright 2016 Google Inc. All Rights Reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
#include <stdint.h>
#include <stdlib.h>
#include <string>
#include <stdio.h>
#include <sodium.h>
int test_func(const uint8_t *Data, size_t Size) {
if (sodium_init() < 0) {
return 1;
}
unsigned char key[crypto_secretbox_KEYBYTES];
unsigned char nonce[crypto_secretbox_NONCEBYTES];
randombytes_buf(key, sizeof key);
randombytes_buf(nonce, sizeof nonce);
unsigned char hash[crypto_generichash_BYTES];
crypto_generichash(hash, sizeof hash, (const unsigned char *)Data, Size, NULL, 0);
unsigned char ciphertext[Size + crypto_secretbox_MACBYTES];
crypto_secretbox_easy(ciphertext, (const unsigned char *)Data, Size, nonce, key);
// 解密
unsigned char decrypted[Size];
if (crypto_secretbox_open_easy(decrypted, ciphertext, sizeof ciphertext, nonce, key) != 0) {
return 1;
}
//非对称加解密
unsigned char public_key[crypto_box_PUBLICKEYBYTES];
unsigned char private_key[crypto_box_SECRETKEYBYTES];
unsigned char nonce1[crypto_box_NONCEBYTES];
unsigned char ciphertext1[Size+ crypto_box_MACBYTES];
// 生成密钥对
crypto_box_keypair(public_key, private_key);
// 生成随机数
randombytes_buf(nonce1, sizeof nonce1);
// 加密
crypto_box_easy(ciphertext1, (const unsigned char *)Data, Size, nonce1, public_key, private_key);
printf("密文: ");
for (int i = 0; i < sizeof ciphertext1; i++) {
printf("%02x", ciphertext1[i]);
}
printf("\n");
// 解密
unsigned char decrypted1[Size];
if (crypto_box_open_easy(decrypted1, ciphertext1, sizeof ciphertext1, nonce1, public_key, private_key) != 0) {
return 1;
}
return 0;
}
int main(int argc, char *argv[]){
if(argc==1){
printf("%s\n", "usage");
return 0;
}
char* file_path = argv[1];
FILE *fp;
if((fp=fopen(file_path, "rb")) == NULL){
printf("cannot open file:%s\n", file_path);
return 0;
}
fseek(fp, 0, SEEK_END);
size_t file_len = ftell(fp);
uint8_t *tmp = (uint8_t*)malloc(sizeof(uint8_t) * file_len);
fseek(fp, 0, SEEK_SET);
fread(tmp, file_len, sizeof(uint8_t), fp);
fclose(fp);
test_func(tmp, file_len);
return 0;
}
```
## fuzz过程
```shell
/home/fuzz_dir/AFL/afl-fuzz -d -i /home/fuzz_dir/AFL/testcases/others/text/ -o ./output ./libsodium_target @@
```
## 参数说明
> 1. **初始化 libsodium**:
> - 使用 `sodium_init()` 初始化库。
> 2. **生成密钥对**:
> - 使用 `crypto_box_keypair()` 生成非对称加密的密钥对。
> - 使用 `crypto_sign_keypair()` 生成签名的密钥对。
> 3. **加密数据**:
> - 使用 `crypto_box_easy()` 加密数据,接收方的公钥用于加密,发送方的私钥用于签名。
> 4. **签名数据**:
> - 使用 `crypto_sign()` 对加密后的数据进行签名。
> 5. **验证签名**:
> - 使用 `crypto_sign_open()` 验证签名,确保数据未被篡改。
> 6. **解密数据**:
> - 使用 `crypto_box_open_easy()` 解密数据,发送方的公钥和接收方的私钥用于解密。
# libexpat
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| -------- | ----- | ------------------------------------ | ---------- | ---------- |
| libexpat | 2.6.4 | https://github.com/libexpat/libexpat | XML 解析库 | 2025-02-26 |
## 编译过程
```shell
git clone https://github.com/libexpat/libexpat
cd libexpat/expat
./buildconf.sh
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure –disable-shared
make -j4
#可执行程序/ path/to/libexpat/expat/xmlwf/xmlwf
cd ./xmlwf/
```
## fuzz过程
```shell
/home/fuzz_dir/AFL/afl-fuzz -i /home/fuzz_dir/AFL/testcases/others/xml/ -o output ./xmlwf -n -x -w -r @@ /dev/null
```
## 参数说明
> ### **选项说明**
>
> #### **输入控制选项**
>
> - `-s`:如果文档不是**独立(standalone)**的,则打印错误。
> - `-n`:启用**命名空间(namespace)**处理。
> - `-p`:启用外部 DTD 和**参数实体(parameter entities)**的处理。
> - `-x`:启用**外部实体(external entities)**的处理。
> - `-e ENCODING`:覆盖文档中的**编码声明**,强制使用指定的编码(如 `UTF-8`)。
> - `-w`:启用对 **Windows 代码页**的支持。
> - `-r`:禁用内存映射,使用 **read 调用**代替。
> - `-g BYTES`:设置每次调用 `XML_GetBuffer` 和 `read` 时的缓冲区大小(默认:8 KiB)。
> - `-k`:处理多个文件时,即使某个文件出错也**继续处理**后续文件。
>
> #### **输出控制选项**
>
> - `-d DIRECTORY`:指定输出文件的**目标目录**。
> - `-c`:写入输入 XML 的**副本**,而非规范化 XML。
> - `-m`:写入**元 XML**,而非规范化 XML。
> - `-t`:不生成 XML 输出,仅用于**计时**普通解析过程。
> - `-N`:启用添加 **DOCTYPE** 和**符号声明(notation declarations)**。
>
> #### **防御 "Billion Laughs" 攻击的选项**
>
> - `-a FACTOR`:设置最大容忍的**放大因子(amplification factor)**(默认:100.0)。
> - `-b BYTES`:设置触发保护的**输出字节数**(默认:8 MiB)。
>
> #### **重新解析延迟选项**
>
> - `-q`:禁用重新解析延迟,允许在存在大标记时出现**二次方解析时间**。
>
> #### **信息选项**
>
> - `-h`, `--help`:显示帮助信息并退出。
> - `-v`, `--version`:显示程序版本号并退出。
>
> ------
>
> ### **退出状态**
>
> - **0**:输入文件格式良好,且输出(如果请求)成功写入。
> - **1**:无法分配数据结构,表明执行环境存在严重问题。
> - **2**:一个或多个输入文件格式不良。
> - **3**:无法创建输出文件。
> - **4**:命令行参数错误。
# icu
## 信息
| 名称 | 版本 | 源码地址 | 简介 | 更新时间 |
| ---- | ---- | -------------------------------------- | -------- | ---------- |
| icu | | https://github.com/unicode-org/icu.git | 字符转义 | 2025-02-26 |
## 编译过程
```shell
git clone https://github.com/unicode-org/icu.git
cd icu/icu4c/source
CC=/home/fuzz_dir/AFL/afl-gcc CXX=/home/fuzz_dir/AFL/afl-g++ ./configure
#可执行程序:/icu4c/source/bin
cd bin
#如果报错可以通过ldd查询缺失的引用,将lib文件夹中的文件复制到系统/lib/x86_64-linux-gnu/文件夹中
```
## fuzz过程
```shell
/home/fuzz_dir/AFL/afl-fuzz -m none -i /home/fuzz_dir/AFL/testcases/others/text/ -o output ./genrb -j -k @@ -d /dev/null
```
## 参数说明
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