diff --git a/fuzzers/frida_libpng/harness.cc b/fuzzers/frida_libpng/harness.cc index b22ec864b4..94327e1561 100644 --- a/fuzzers/frida_libpng/harness.cc +++ b/fuzzers/frida_libpng/harness.cc @@ -115,9 +115,9 @@ void func1() { // Export this symbol #ifdef _WIN32 -# define HARNESS_EXPORTS __declspec(dllexport) +# define HARNESS_EXPORTS __declspec(dllexport) #else -# define HARNESS_EXPORTS +# define HARNESS_EXPORTS #endif // Entry point for LibFuzzer. diff --git a/fuzzers/fuzzbench_fork_qemu/Makefile.toml b/fuzzers/fuzzbench_fork_qemu/Makefile.toml index e7963041a0..987b46a564 100644 --- a/fuzzers/fuzzbench_fork_qemu/Makefile.toml +++ b/fuzzers/fuzzbench_fork_qemu/Makefile.toml @@ -46,14 +46,14 @@ cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardw cd "${PROJECT_DIR}" make -C libpng-1.6.37 cc -c "${PROJECT_DIR}/libfuzzer_main.c" -# Build the libpng harness +# Build the libpng harness c++ \ - ../libfuzzer_libpng/harness.cc \ - ./libpng-1.6.37/.libs/libpng16.a \ - ./libfuzzer_main.o \ - -I./libpng-1.6.37/ \ - -o ${FUZZER_NAME} \ - -lm -lz + ../libfuzzer_libpng/harness.cc \ + ./libpng-1.6.37/.libs/libpng16.a \ + ./libfuzzer_main.o \ + -I./libpng-1.6.37/ \ + -o ${FUZZER_NAME} \ + -lm -lz ''' dependencies = ["libpng"] diff --git a/fuzzers/fuzzbench_qemu/Makefile.toml b/fuzzers/fuzzbench_qemu/Makefile.toml index e7963041a0..987b46a564 100644 --- a/fuzzers/fuzzbench_qemu/Makefile.toml +++ b/fuzzers/fuzzbench_qemu/Makefile.toml @@ -46,14 +46,14 @@ cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardw cd "${PROJECT_DIR}" make -C libpng-1.6.37 cc -c "${PROJECT_DIR}/libfuzzer_main.c" -# Build the libpng harness +# Build the libpng harness c++ \ - ../libfuzzer_libpng/harness.cc \ - ./libpng-1.6.37/.libs/libpng16.a \ - ./libfuzzer_main.o \ - -I./libpng-1.6.37/ \ - -o ${FUZZER_NAME} \ - -lm -lz + ../libfuzzer_libpng/harness.cc \ + ./libpng-1.6.37/.libs/libpng16.a \ + ./libfuzzer_main.o \ + -I./libpng-1.6.37/ \ + -o ${FUZZER_NAME} \ + -lm -lz ''' dependencies = ["libpng"] diff --git a/fuzzers/libfuzzer_libmozjpeg/harness.cc b/fuzzers/libfuzzer_libmozjpeg/harness.cc index 6e43bb662f..8ce7b9c1b3 100644 --- a/fuzzers/libfuzzer_libmozjpeg/harness.cc +++ b/fuzzers/libfuzzer_libmozjpeg/harness.cc @@ -5,9 +5,9 @@ struct my_error_mgr { - struct jpeg_error_mgr pub; /* "public" fields */ + struct jpeg_error_mgr pub; /* "public" fields */ - jmp_buf setjmp_buffer; /* for return to caller */ + jmp_buf setjmp_buffer; /* for return to caller */ }; typedef struct my_error_mgr *my_error_ptr; @@ -16,18 +16,18 @@ typedef struct my_error_mgr *my_error_ptr; * Here's the routine that will replace the standard error_exit method: */ - METHODDEF(void) + METHODDEF(void) my_error_exit(j_common_ptr cinfo) { - /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */ - my_error_ptr myerr = (my_error_ptr)cinfo->err; + /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */ + my_error_ptr myerr = (my_error_ptr)cinfo->err; - /* Always display the message. */ - /* We could postpone this until after returning, if we chose. */ - (*cinfo->err->output_message) (cinfo); + /* Always display the message. */ + /* We could postpone this until after returning, if we chose. */ + (*cinfo->err->output_message) (cinfo); - /* Return control to the setjmp point */ - longjmp(myerr->setjmp_buffer, 1); + /* Return control to the setjmp point */ + longjmp(myerr->setjmp_buffer, 1); } @@ -35,48 +35,48 @@ my_error_exit(j_common_ptr cinfo) int do_read_JPEG_file(struct jpeg_decompress_struct *cinfo, const uint8_t *input, size_t len) { - struct my_error_mgr jerr; - /* More stuff */ - JSAMPARRAY buffer; /* Output row buffer */ - int row_stride; /* physical row width in output buffer */ - /* Step 1: allocate and initialize JPEG decompression object */ - /* We set up the normal JPEG error routines, then override error_exit. */ - cinfo->err = jpeg_std_error(&jerr.pub); - jerr.pub.error_exit = my_error_exit; - /* Establish the setjmp return context for my_error_exit to use. */ - if (setjmp(jerr.setjmp_buffer)) { - jpeg_destroy_decompress(cinfo); - return 0; - } - /* Now we can initialize the JPEG decompression object. */ - jpeg_create_decompress(cinfo); - /* Step 2: specify data source (eg, a file) */ - jpeg_mem_src(cinfo,input, len ); - /* Step 3: read file parameters with jpeg_read_header() */ - (void)jpeg_read_header(cinfo, TRUE); - /* Step 4: set parameters for decompression */ - /* In this example, we don't need to change any of the defaults set by - * jpeg_read_header(), so we do nothing here. - */ - /* Step 5: Start decompressor */ - (void)jpeg_start_decompress(cinfo); - /* JSAMPLEs per row in output buffer */ - row_stride = cinfo->output_width * cinfo->output_components; - /* Make a one-row-high sample array that will go away when done with image */ - buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr)cinfo, JPOOL_IMAGE, row_stride, 1); - /* Step 6: while (scan lines remain to be read) */ - /* jpeg_read_scanlines(...); */ - while (cinfo->output_scanline < cinfo->output_height) { - (void)jpeg_read_scanlines(cinfo, buffer, 1); - /* Assume put_scanline_someplace wants a pointer and sample count. */ - //put_scanline_someplace(buffer[0], row_stride); - } - /* Step 7: Finish decompression */ - (void)jpeg_finish_decompress(cinfo); - /* Step 8: Release JPEG decompression object */ - //jpeg_destroy_decompress(cinfo); - return 1; + struct my_error_mgr jerr; + /* More stuff */ + JSAMPARRAY buffer; /* Output row buffer */ + int row_stride; /* physical row width in output buffer */ + /* Step 1: allocate and initialize JPEG decompression object */ + /* We set up the normal JPEG error routines, then override error_exit. */ + cinfo->err = jpeg_std_error(&jerr.pub); + jerr.pub.error_exit = my_error_exit; + /* Establish the setjmp return context for my_error_exit to use. */ + if (setjmp(jerr.setjmp_buffer)) { + jpeg_destroy_decompress(cinfo); + return 0; + } + /* Now we can initialize the JPEG decompression object. */ + jpeg_create_decompress(cinfo); + /* Step 2: specify data source (eg, a file) */ + jpeg_mem_src(cinfo,input, len ); + /* Step 3: read file parameters with jpeg_read_header() */ + (void)jpeg_read_header(cinfo, TRUE); + /* Step 4: set parameters for decompression */ + /* In this example, we don't need to change any of the defaults set by + * jpeg_read_header(), so we do nothing here. + */ + /* Step 5: Start decompressor */ + (void)jpeg_start_decompress(cinfo); + /* JSAMPLEs per row in output buffer */ + row_stride = cinfo->output_width * cinfo->output_components; + /* Make a one-row-high sample array that will go away when done with image */ + buffer = (*cinfo->mem->alloc_sarray) + ((j_common_ptr)cinfo, JPOOL_IMAGE, row_stride, 1); + /* Step 6: while (scan lines remain to be read) */ + /* jpeg_read_scanlines(...); */ + while (cinfo->output_scanline < cinfo->output_height) { + (void)jpeg_read_scanlines(cinfo, buffer, 1); + /* Assume put_scanline_someplace wants a pointer and sample count. */ + //put_scanline_someplace(buffer[0], row_stride); + } + /* Step 7: Finish decompression */ + (void)jpeg_finish_decompress(cinfo); + /* Step 8: Release JPEG decompression object */ + //jpeg_destroy_decompress(cinfo); + return 1; } @@ -84,9 +84,9 @@ int do_read_JPEG_file(struct jpeg_decompress_struct *cinfo, const uint8_t *input extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - struct jpeg_decompress_struct cinfo; - do_read_JPEG_file(&cinfo,data,size); - return 0; + struct jpeg_decompress_struct cinfo; + do_read_JPEG_file(&cinfo,data,size); + return 0; } diff --git a/fuzzers/libfuzzer_stb_image/harness.c b/fuzzers/libfuzzer_stb_image/harness.c index be70ac5d98..44b62a113b 100644 --- a/fuzzers/libfuzzer_stb_image/harness.c +++ b/fuzzers/libfuzzer_stb_image/harness.c @@ -21,8 +21,8 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) unsigned char *img = stbi_load_from_memory(data, size, &x, &y, &channels, 4); free(img); - - // if (x > 10000) free(img); // free crash + + // if (x > 10000) free(img); // free crash return 0; } diff --git a/fuzzers/libfuzzer_stb_image/stb_image.h b/fuzzers/libfuzzer_stb_image/stb_image.h index 6542ede682..94ae88d11d 100644 --- a/fuzzers/libfuzzer_stb_image/stb_image.h +++ b/fuzzers/libfuzzer_stb_image/stb_image.h @@ -1270,7 +1270,7 @@ STBI_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int #if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) { - return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); + return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); } #endif @@ -1280,15 +1280,15 @@ static FILE *stbi__fopen(char const *filename, char const *mode) #if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) wchar_t wMode[64]; wchar_t wFilename[1024]; - if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename))) + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename))) return 0; - if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode))) + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode))) return 0; #if _MSC_VER >= 1400 - if (0 != _wfopen_s(&f, wFilename, wMode)) - f = 0; + if (0 != _wfopen_s(&f, wFilename, wMode)) + f = 0; #else f = _wfopen(wFilename, wMode); #endif @@ -5184,7 +5184,7 @@ static int stbi__png_is16(stbi__context *s) stbi__png p; p.s = s; if (!stbi__png_info_raw(&p, NULL, NULL, NULL)) - return 0; + return 0; if (p.depth != 16) { stbi__rewind(p.s); return 0; diff --git a/fuzzers/libfuzzer_stb_image_concolic/fuzzer/harness.c b/fuzzers/libfuzzer_stb_image_concolic/fuzzer/harness.c index be70ac5d98..44b62a113b 100644 --- a/fuzzers/libfuzzer_stb_image_concolic/fuzzer/harness.c +++ b/fuzzers/libfuzzer_stb_image_concolic/fuzzer/harness.c @@ -21,8 +21,8 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) unsigned char *img = stbi_load_from_memory(data, size, &x, &y, &channels, 4); free(img); - - // if (x > 10000) free(img); // free crash + + // if (x > 10000) free(img); // free crash return 0; } diff --git a/fuzzers/libfuzzer_stb_image_concolic/fuzzer/stb_image.h b/fuzzers/libfuzzer_stb_image_concolic/fuzzer/stb_image.h index 6542ede682..94ae88d11d 100644 --- a/fuzzers/libfuzzer_stb_image_concolic/fuzzer/stb_image.h +++ b/fuzzers/libfuzzer_stb_image_concolic/fuzzer/stb_image.h @@ -1270,7 +1270,7 @@ STBI_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int #if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) { - return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); + return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); } #endif @@ -1280,15 +1280,15 @@ static FILE *stbi__fopen(char const *filename, char const *mode) #if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) wchar_t wMode[64]; wchar_t wFilename[1024]; - if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename))) + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename))) return 0; - if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode))) + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode))) return 0; #if _MSC_VER >= 1400 - if (0 != _wfopen_s(&f, wFilename, wMode)) - f = 0; + if (0 != _wfopen_s(&f, wFilename, wMode)) + f = 0; #else f = _wfopen(wFilename, wMode); #endif @@ -5184,7 +5184,7 @@ static int stbi__png_is16(stbi__context *s) stbi__png p; p.s = s; if (!stbi__png_info_raw(&p, NULL, NULL, NULL)) - return 0; + return 0; if (p.depth != 16) { stbi__rewind(p.s); return 0; diff --git a/fuzzers/libfuzzer_stb_image_sugar/harness.c b/fuzzers/libfuzzer_stb_image_sugar/harness.c index be70ac5d98..44b62a113b 100644 --- a/fuzzers/libfuzzer_stb_image_sugar/harness.c +++ b/fuzzers/libfuzzer_stb_image_sugar/harness.c @@ -21,8 +21,8 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) unsigned char *img = stbi_load_from_memory(data, size, &x, &y, &channels, 4); free(img); - - // if (x > 10000) free(img); // free crash + + // if (x > 10000) free(img); // free crash return 0; } diff --git a/fuzzers/libfuzzer_stb_image_sugar/stb_image.h b/fuzzers/libfuzzer_stb_image_sugar/stb_image.h index 6542ede682..94ae88d11d 100644 --- a/fuzzers/libfuzzer_stb_image_sugar/stb_image.h +++ b/fuzzers/libfuzzer_stb_image_sugar/stb_image.h @@ -1270,7 +1270,7 @@ STBI_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int #if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) { - return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); + return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); } #endif @@ -1280,15 +1280,15 @@ static FILE *stbi__fopen(char const *filename, char const *mode) #if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) wchar_t wMode[64]; wchar_t wFilename[1024]; - if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename))) + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename))) return 0; - if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode))) + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode))) return 0; #if _MSC_VER >= 1400 - if (0 != _wfopen_s(&f, wFilename, wMode)) - f = 0; + if (0 != _wfopen_s(&f, wFilename, wMode)) + f = 0; #else f = _wfopen(wFilename, wMode); #endif @@ -5184,7 +5184,7 @@ static int stbi__png_is16(stbi__context *s) stbi__png p; p.s = s; if (!stbi__png_info_raw(&p, NULL, NULL, NULL)) - return 0; + return 0; if (p.depth != 16) { stbi__rewind(p.s); return 0; diff --git a/fuzzers/qemu_launcher/Makefile.toml b/fuzzers/qemu_launcher/Makefile.toml index 27b1e5fcbe..d395454a7c 100644 --- a/fuzzers/qemu_launcher/Makefile.toml +++ b/fuzzers/qemu_launcher/Makefile.toml @@ -45,13 +45,13 @@ script=''' cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes cd "${PROJECT_DIR}" make -C libpng-1.6.37 -# Build the libpng harness +# Build the libpng harness c++ \ - ./harness.cc \ - ./libpng-1.6.37/.libs/libpng16.a \ - -I./libpng-1.6.37/ \ - -o ${FUZZER_NAME} \ - -lm -lz + ./harness.cc \ + ./libpng-1.6.37/.libs/libpng16.a \ + -I./libpng-1.6.37/ \ + -o ${FUZZER_NAME} \ + -lm -lz ''' dependencies = [ "libpng" ] diff --git a/libafl/Cargo.toml b/libafl/Cargo.toml index 42502d2949..f0f0ac7b81 100644 --- a/libafl/Cargo.toml +++ b/libafl/Cargo.toml @@ -13,7 +13,7 @@ categories = ["development-tools::testing", "emulators", "embedded", "os", "no-s [features] default = ["std", "derive", "llmp_compression", "rand_trait", "fork"] -std = ["serde_json", "serde_json/std", "hostname", "core_affinity", "nix", "serde/std", "bincode", "wait-timeout", "regex", "build_id", "uuid", "tui_monitor", "ctor", "backtrace"] # print, env, launcher ... support +std = ["serde_json", "serde_json/std", "hostname", "core_affinity", "nix", "serde/std", "bincode", "wait-timeout", "regex", "byteorder", "once_cell", "uuid", "tui_monitor", "ctor", "backtrace"] # print, env, launcher ... support derive = ["libafl_derive"] # provide derive(SerdeAny) macro. fork = [] # uses the fork() syscall to spawn children, instead of launching a new command, if supported by the OS (has no effect on Windows, no_std). rand_trait = ["rand_core"] # If set, libafl's rand implementations will implement `rand::Rng` @@ -73,8 +73,9 @@ hostname = { version = "^0.3", optional = true } # Is there really no gethostnam rand_core = { version = "0.5.1", optional = true } # This dependency allows us to export our RomuRand as rand::Rng. We cannot update to the latest version because it breaks compatibility to microsoft lain. nix = { version = "0.23", optional = true } regex = { version = "1", optional = true } -build_id = { version = "0.2.1", git = "https://github.com/domenukk/build_id", rev = "6a61943", optional = true } uuid = { version = "0.8.2", optional = true, features = ["serde", "v4"] } +byteorder = { version = "1.2", optional = true } +once_cell = { version = "1.2", optional = true } libm = "0.2.1" tui = { version = "0.16", default-features = false, features = ['crossterm'], optional = true } crossterm = { version = "0.20", optional = true } diff --git a/libafl/src/bolts/build_id.rs b/libafl/src/bolts/build_id.rs new file mode 100644 index 0000000000..e531afed3c --- /dev/null +++ b/libafl/src/bolts/build_id.rs @@ -0,0 +1,111 @@ +//! Based on +//! (C) Alec Mocatta under license MIT or Apache 2 + +use once_cell::sync::Lazy; +use std::{ + any::TypeId, + env, + fs::File, + hash::{Hash, Hasher}, + io, +}; +use uuid::Uuid; + +static BUILD_ID: Lazy = Lazy::new(calculate); + +/// Returns a [Uuid] uniquely representing the build of the current binary. +/// +/// This is intended to be used to check that different processes are indeed +/// invocations of identically laid out binaries. +/// +/// As such: +/// * It is guaranteed to be identical within multiple invocations of the same +/// binary. +/// * It is guaranteed to be different across binaries with different code or +/// data segments or layout. +/// * Equality is unspecified if the binaries have identical code and data +/// segments and layout but differ immaterially (e.g. if a timestamp is included +/// in the binary at compile time). +/// +/// # Examples +/// +/// ``` +/// # let remote_build_id = libafl::bolts::build_id::get(); +/// let local_build_id = libafl::bolts::build_id::get(); +/// if local_build_id == remote_build_id { +/// println!("We're running the same binary as remote!"); +/// } else { +/// println!("We're running a different binary to remote"); +/// } +/// ``` +/// +/// # Note +/// +/// This looks first for linker-inserted build ID / binary UUIDs (i.e. +/// `.note.gnu.build-id` on Linux; `LC_UUID` in Mach-O; etc), falling back to +/// hashing the whole binary. +#[inline] +#[must_use] +pub fn get() -> Uuid { + *BUILD_ID +} + +fn from_exe(mut hasher: H) -> Result { + #[cfg(not(target_arch = "wasm32"))] + { + if cfg!(miri) { + return Err(()); + } + let file = File::open(env::current_exe().map_err(drop)?).map_err(drop)?; + let _ = io::copy(&mut &file, &mut HashWriter(&mut hasher)).map_err(drop)?; + Ok(hasher) + } + #[cfg(target_arch = "wasm32")] + { + let _ = &mut hasher; + Err(()) + } +} +fn from_type_id(mut hasher: H) -> H { + fn type_id_of(_: &T) -> TypeId { + TypeId::of::() + } + TypeId::of::<()>().hash(&mut hasher); + TypeId::of::().hash(&mut hasher); + let a = |x: ()| x; + type_id_of(&a).hash(&mut hasher); + let b = |x: u8| x; + type_id_of(&b).hash(&mut hasher); + hasher +} + +fn calculate() -> Uuid { + let hasher = xxhash_rust::xxh3::Xxh3::with_seed(0); + + let hasher = from_exe(hasher.clone()).unwrap_or(hasher); + let mut hasher = from_type_id(hasher); + + let mut bytes = [0; 16]; + ::write_u64(&mut bytes[..8], hasher.finish()); + hasher.write_u8(0); + ::write_u64(&mut bytes[8..], hasher.finish()); + + uuid::Builder::from_bytes(bytes) + .set_variant(uuid::Variant::RFC4122) + .set_version(uuid::Version::Random) + .build() +} + +struct HashWriter(T); +impl io::Write for HashWriter { + fn write(&mut self, buf: &[u8]) -> io::Result { + self.0.write(buf); + Ok(buf.len()) + } + fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { + self.write(buf).map(|_| ()) + } + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} diff --git a/libafl/src/bolts/mod.rs b/libafl/src/bolts/mod.rs index 8595f8f1c0..eb3c58af3d 100644 --- a/libafl/src/bolts/mod.rs +++ b/libafl/src/bolts/mod.rs @@ -1,6 +1,8 @@ //! Bolts are no conceptual fuzzing elements, but they keep libafl-based fuzzers together. pub mod anymap; +#[cfg(feature = "std")] +pub mod build_id; #[cfg(all( any(feature = "cli", feature = "frida_cli", feature = "qemu_cli"), feature = "std" diff --git a/libafl/src/events/mod.rs b/libafl/src/events/mod.rs index 593c08f36a..f90e027776 100644 --- a/libafl/src/events/mod.rs +++ b/libafl/src/events/mod.rs @@ -106,7 +106,7 @@ impl EventConfig { #[must_use] pub fn from_build_id() -> Self { EventConfig::BuildID { - id: build_id::get(), + id: crate::bolts::build_id::get(), } } diff --git a/utils/gramatron/grammars/test1.json b/utils/gramatron/grammars/test1.json index cf39330537..47e1474e38 100644 --- a/utils/gramatron/grammars/test1.json +++ b/utils/gramatron/grammars/test1.json @@ -1,4 +1,4 @@ { - "B": ["'a'", "'b'"], - "A": ["A 'a'", "'a'"] + "B": ["'a'", "'b'"], + "A": ["A 'a'", "'a'"] }