Skip to content

Instantly share code, notes, and snippets.

@vlussenburg
Created May 29, 2024 02:16
Show Gist options
  • Save vlussenburg/441213ce01d23aeba7853efde2616860 to your computer and use it in GitHub Desktop.
Save vlussenburg/441213ce01d23aeba7853efde2616860 to your computer and use it in GitHub Desktop.
FROM ubuntu:20.04
WORKDIR /app
RUN apt clean && rm -rf /var/lib/apt/lists/* && apt update -o Acquire::CompressionTypes::Order::=gz
RUN apt -y install wget build-essential tar gcc
RUN wget https://dl.xpdfreader.com/old/xpdf-3.02.tar.gz
RUN tar -xvzf xpdf-3.02.tar.gz
RUN cd xpdf-3.02 && \
./configure --prefix="/app/fuzzing_xpdf/install/" && \
make && \
make install
RUN mkdir pdf_examples && \
cd pdf_examples && \
wget https://github.com/mozilla/pdf.js-sample-files/raw/master/helloworld.pdf && \
wget https://www.melbpc.org.au/wp-content/uploads/2017/10/small-example-pdf-file.pdf
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential python3-dev automake git flex bison libglib2.0-dev libpixman-1-dev python3-setuptools
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y lld-11 llvm-11 llvm-11-dev clang-11 || sudo apt-get install -y lld llvm llvm-dev clang
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc-$(gcc --version|head -n1|sed 's/.* //'|sed 's/\..*//')-plugin-dev libstdc++-$(gcc --version|head -n1|sed 's/.* //'|sed 's/\..*//')-dev
RUN git clone https://github.com/AFLplusplus/AFLplusplus && cd AFLplusplus && LLVM_CONFIG="llvm-config-11" make distrib && make install
RUN cd xpdf-3.02 && make clean && LLVM_CONFIG="llvm-config-11" CC=/app/AFLplusplus/afl-clang-fast CXX=/app/AFLplusplus/afl-clang-fast++ ./configure --prefix="/app/fuzzing_xpdf/install/" && make && make install
RUN echo "afl-fuzz -i /app/pdf_examples/ -o /app/fuzzing_xpdf/out/ -s 123 -- /app/fuzzing_xpdf/install/bin/pdftotext @@ /app/fuzzing_xpdf/output"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment