Rename fuzzer source files to simplify oss-fuzz build script

This commit is contained in:
Martijn van Beurden 2023-02-21 11:24:25 +01:00
parent 3baaf23faa
commit 8daf62da0c
9 changed files with 20 additions and 41 deletions

View File

@ -194,6 +194,8 @@ static inline void *safe_malloc_muladd2_(size_t size1, size_t size2, size_t size
static inline void *safe_realloc_(void *ptr, size_t size)
{
void *oldptr;
void *newptr;
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
/* Fail if requested */
if(alloc_check() && size > 0) {
@ -201,8 +203,8 @@ static inline void *safe_realloc_(void *ptr, size_t size)
return NULL;
}
#endif
void *oldptr = ptr;
void *newptr = realloc(ptr, size);
oldptr = ptr;
newptr = realloc(ptr, size);
if(size > 0 && newptr == 0)
free(oldptr);
return newptr;

View File

@ -17,11 +17,13 @@
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/oss-fuzz
AM_CXXFLAGS = -std=c++11
AM_CXXFLAGS = -std=c++11 $(LIB_FUZZING_ENGINE)
LDADD = $(flac_libs)
EXTRA_DIST = \
fuzzer_encoder.dict \
fuzzer_common.h \
common.h \
Readme.md \
fuzzing/datasource/datasource.hpp \
fuzzing/datasource/id.hpp \
@ -35,37 +37,12 @@ if USE_OSSFUZZERS
noinst_PROGRAMS += fuzzer_encoder fuzzer_encoder_v2 fuzzer_decoder fuzzer_seek fuzzer_metadata fuzzer_reencoder
endif
fuzzer_encoder_SOURCES = fuzzer_encoder.cc
fuzzer_encoder_CXXFLAGS = $(AM_CXXFLAGS) $(LIB_FUZZING_ENGINE)
fuzzer_encoder_LDFLAGS = $(AM_LDFLAGS)
fuzzer_encoder_LDADD = $(flac_libs)
fuzzer_encoder_v2_SOURCES = fuzzer_encoder_v2.cc
fuzzer_encoder_v2_CXXFLAGS = $(AM_CXXFLAGS) $(LIB_FUZZING_ENGINE)
fuzzer_encoder_v2_LDFLAGS = $(AM_LDFLAGS)
fuzzer_encoder_v2_LDADD = $(flac_libs)
fuzzer_decoder_SOURCES = fuzzer_decoder.cc
fuzzer_decoder_CXXFLAGS = $(AM_CXXFLAGS) $(LIB_FUZZING_ENGINE)
fuzzer_decoder_LDFLAGS = $(AM_LDFLAGS)
fuzzer_decoder_LDADD = $(flac_libs)
fuzzer_seek_SOURCES = fuzzer_seek.cc
fuzzer_seek_CXXFLAGS = $(AM_CXXFLAGS) $(LIB_FUZZING_ENGINE)
fuzzer_seek_LDFLAGS = $(AM_LDFLAGS)
fuzzer_seek_LDADD = $(flac_libs)
fuzzer_metadata_SOURCES = fuzzer_metadata.cc
fuzzer_metadata_CXXFLAGS = $(AM_CXXFLAGS) $(LIB_FUZZING_ENGINE)
fuzzer_metadata_LDFLAGS = $(AM_LDFLAGS)
fuzzer_metadata_LDADD = $(flac_libs)
fuzzer_reencoder_SOURCES = fuzzer_reencoder.cc
fuzzer_reencoder_CXXFLAGS = $(AM_CXXFLAGS) $(LIB_FUZZING_ENGINE)
fuzzer_reencoder_LDFLAGS = $(AM_LDFLAGS)
fuzzer_reencoder_LDADD = $(flac_libs)
fuzzer_encoder_SOURCES = encoder.cc
fuzzer_encoder_v2_SOURCES = encoder_v2.cc
fuzzer_decoder_SOURCES = decoder.cc
fuzzer_seek_SOURCES = seek.cc
fuzzer_metadata_SOURCES = metadata.cc
fuzzer_reencoder_SOURCES = reencoder.cc
flac_libs = \
$(top_builddir)/src/libFLAC/libFLAC-static.la \

View File

@ -29,7 +29,7 @@
#include "FLAC++/decoder.h"
#include "FLAC++/metadata.h"
#include "fuzzer_common.h"
#include "common.h"
template <> FLAC__MetadataType fuzzing::datasource::Base::Get<FLAC__MetadataType>(const uint64_t id) {
(void)id;

View File

@ -29,7 +29,7 @@
#include <fuzzing/memory.hpp>
#include "FLAC++/encoder.h"
#include "fuzzer_common.h"
#include "common.h"
namespace FLAC {
namespace Encoder {

View File

@ -36,7 +36,7 @@
extern "C" {
#include "share/private.h"
}
#include "fuzzer_common.h"
#include "common.h"
/* This C++ fuzzer uses the FLAC and not FLAC++ because the latter lacks a few
* hidden functions like FLAC__stream_encoder_disable_constant_subframes. It

View File

@ -34,7 +34,7 @@
#include <cstring> /* for memcpy */
#include <unistd.h>
#include "FLAC++/metadata.h"
#include "fuzzer_common.h"
#include "common.h"
#define CONFIG_LENGTH 2

View File

@ -31,7 +31,7 @@
#include "FLAC++/encoder.h"
#include "FLAC++/decoder.h"
#include "FLAC++/metadata.h"
#include "fuzzer_common.h"
#include "common.h"
#define MAX_NUM_METADATA_BLOCKS 2048

View File

@ -32,7 +32,7 @@
#include <cstdlib>
#include <cstring> /* for memcpy */
#include "FLAC/stream_decoder.h"
#include "fuzzer_common.h"
#include "common.h"
int write_abort_check_counter = -1;