mirror of
				https://git.code.sf.net/p/libpng/code.git
				synced 2025-07-10 18:04:09 +02:00 
			
		
		
		
	oss-fuzz: Update the README file, the Docker file and the build script
This commit is contained in:
		
							parent
							
								
									5a7e87fc04
								
							
						
					
					
						commit
						3117b5f94a
					
				@ -1,3 +1,5 @@
 | 
			
		||||
# Copyright 2024 Cosmin Truta
 | 
			
		||||
# Copyright 2017 Glenn Randers-Pehrson
 | 
			
		||||
# Copyright 2016 Google Inc.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
@ -15,11 +17,12 @@
 | 
			
		||||
################################################################################
 | 
			
		||||
 | 
			
		||||
FROM gcr.io/oss-fuzz-base/base-builder
 | 
			
		||||
MAINTAINER glennrp@gmail.com
 | 
			
		||||
RUN apt-get update && \
 | 
			
		||||
    apt-get install -y make autoconf automake libtool
 | 
			
		||||
 | 
			
		||||
RUN git clone --depth 1 https://github.com/madler/zlib.git
 | 
			
		||||
RUN git clone --depth 1 https://github.com/glennrp/libpng.git
 | 
			
		||||
RUN cp libpng/contrib/oss-fuzz/build.sh $SRC
 | 
			
		||||
WORKDIR libpng
 | 
			
		||||
RUN apt-get update && \
 | 
			
		||||
    apt-get install -y make autoconf automake libtool zlib1g-dev
 | 
			
		||||
 | 
			
		||||
RUN git clone --depth=1 https://github.com/pnggroup/libpng.git && \
 | 
			
		||||
    git clone --depth=1 https://github.com/madler/zlib.git && \
 | 
			
		||||
    cp libpng/contrib/oss-fuzz/build.sh $SRC
 | 
			
		||||
 | 
			
		||||
WORKDIR /home/libpng
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,7 @@
 | 
			
		||||
libpng additions to oss-fuzz
 | 
			
		||||
============================
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2024 Cosmin Truta
 | 
			
		||||
Copyright (c) 2017 Glenn Randers-Pehrson
 | 
			
		||||
 | 
			
		||||
This code is released under the libpng license.
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,8 @@
 | 
			
		||||
#!/bin/bash -eu
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -eu
 | 
			
		||||
 | 
			
		||||
# Copyright 2017-2018 Glenn Randers-Pehrson
 | 
			
		||||
# Copyright 2024 Cosmin Truta
 | 
			
		||||
# Copyright 2017 Glenn Randers-Pehrson
 | 
			
		||||
# Copyright 2016 Google Inc.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
@ -15,36 +17,31 @@
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
#
 | 
			
		||||
# Revisions by Glenn Randers-Pehrson, 2017:
 | 
			
		||||
# 1. Build only the library, not the tools (changed "make -j$(nproc) all" to
 | 
			
		||||
#     "make -j$(nproc) libpng16.la").
 | 
			
		||||
# 2. Disabled WARNING and WRITE options in pnglibconf.dfa.
 | 
			
		||||
# 3. Build zlib alongside libpng
 | 
			
		||||
################################################################################
 | 
			
		||||
 | 
			
		||||
# Disable logging via library build configuration control.
 | 
			
		||||
cat scripts/pnglibconf.dfa | \
 | 
			
		||||
sed -e "s/option STDIO/option STDIO disabled/" \
 | 
			
		||||
    -e "s/option WARNING /option WARNING disabled/" \
 | 
			
		||||
    -e "s/option WRITE enables WRITE_INT_FUNCTIONS/option WRITE disabled/" \
 | 
			
		||||
> scripts/pnglibconf.dfa.temp
 | 
			
		||||
mv scripts/pnglibconf.dfa.temp scripts/pnglibconf.dfa
 | 
			
		||||
    scripts/pnglibconf.dfa >scripts/pnglibconf.dfa.tmp
 | 
			
		||||
mv -f scripts/pnglibconf.dfa.tmp scripts/pnglibconf.dfa
 | 
			
		||||
 | 
			
		||||
# build the libpng library.
 | 
			
		||||
# Build the libpng library ("libpng16.la"), excluding the auxiliary tools.
 | 
			
		||||
autoreconf -f -i
 | 
			
		||||
./configure --with-libpng-prefix=OSS_FUZZ_
 | 
			
		||||
make -j$(nproc) clean
 | 
			
		||||
make -j$(nproc) libpng16.la
 | 
			
		||||
 | 
			
		||||
# build libpng_read_fuzzer.
 | 
			
		||||
# Build libpng_read_fuzzer.
 | 
			
		||||
$CXX $CXXFLAGS -std=c++11 -I. \
 | 
			
		||||
     $SRC/libpng/contrib/oss-fuzz/libpng_read_fuzzer.cc \
 | 
			
		||||
     -o $OUT/libpng_read_fuzzer \
 | 
			
		||||
     -lFuzzingEngine .libs/libpng16.a -lz
 | 
			
		||||
 | 
			
		||||
# add seed corpus.
 | 
			
		||||
# Add seed corpus.
 | 
			
		||||
find $SRC/libpng -name "*.png" | grep -v crashers | \
 | 
			
		||||
     xargs zip $OUT/libpng_read_fuzzer_seed_corpus.zip
 | 
			
		||||
 | 
			
		||||
cp $SRC/libpng/contrib/oss-fuzz/*.dict \
 | 
			
		||||
     $SRC/libpng/contrib/oss-fuzz/*.options $OUT/
 | 
			
		||||
   $SRC/libpng/contrib/oss-fuzz/*.options \
 | 
			
		||||
   $OUT/
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user