首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么afl++不能编译ImageMagick?

为什么afl++不能编译ImageMagick?
EN

Stack Overflow用户
提问于 2020-12-29 19:19:16
回答 2查看 640关注 0票数 0

我正在尝试用工具afl (链接)进行一些模糊测试。我下载了ImageMagick 如文档中所述的源代码,但是当我尝试使用afl编译器运行./configure时,会得到一个错误:

代码语言:javascript
复制
$ CC=/usr/local/bin/afl-gcc CXX=/usr/local/bin/afl-g++ ./configure --disable-shared
[...]
checking whether we are using the GNU C++ compiler... no
checking whether /usr/local/bin/afl-g++ accepts -g... no
checking dependency style of /usr/local/bin/afl-g++... none
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/home/ubuntu/ImageMagick-7.0.10':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

如果我尝试使用默认的c++编译器,一切看起来都很好:

代码语言:javascript
复制
$ CC=/usr/local/bin/afl-gcc ./configure --disable-shared #this works

如何使编译器运行?

更新

config.log内部看,问题似乎与ImageMagick无法检查afl-g++版本有关:

代码语言:javascript
复制
configure:15015: checking for C++ compiler version
configure:15024: /usr/local/bin/afl-g++ --version >&5
)B[?25h[0m[1;91m
[-] PROGRAM ABORT : [1;97mOops, failed to execute 'g++' - check your PATH[1;91m
         Location : [0mmain(), afl-gcc.c:334

configure:15035: $? = 1

不管怎么说,afl-g++似乎很管用:

代码语言:javascript
复制
$ afl-g++
afl-cc 2.52b by <lcamtuf@google.com>

This is a helper application for afl-fuzz. It serves as a drop-in replacement
for gcc or clang, letting you recompile third-party code with the required
runtime instrumentation. A common use pattern would be one of the following:

  CC=/usr/local/bin/afl-gcc ./configure
  CXX=/usr/local/bin/afl-g++ ./configure

You can specify custom next-stage toolchain via AFL_CC, AFL_CXX, and AFL_AS.
Setting AFL_HARDEN enables hardening optimizations in the compiled code.

但是afl-g++ -v报告错误:

代码语言:javascript
复制
$ afl-g++ -v
afl-cc 2.52b by <lcamtuf@google.com>

[-] PROGRAM ABORT : Oops, failed to execute 'g++' - check your PATH
         Location : main(), afl-gcc.c:334
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-12-30 14:58:32

结果发现,问题在于我的系统中没有g++。可能是因为我已经安装了Ubuntu20.04LTS的最小版本。我安装了g++

代码语言:javascript
复制
sudo apt install g++

现在一切似乎都正常了。

票数 0
EN

Stack Overflow用户

发布于 2020-12-30 13:32:01

你被限制使用afl的gcc吗?如果没有,请使用它们的clang包装:

我可以像这样启动AFL:

代码语言:javascript
复制
git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick-7.0.10
cd ImageMagick-7.0.10

CC=afl-clang CXX=afl-clang++ ./configure --disable-shared
make

#prepare AFL environment
AFL_SKIP_CPU_FREQ=1 AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 afl-fuzz -i ./in -o ./out -- ./utilities/magick @@ /dev/null

显然,像这样启动AFL很难有意义--我只是说我能够以这种方式快速启动它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65497542

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档