<commit_before>/*
 * This is a sample for use by LibFuzzer.
 *
 * How to build:
 * install clang
 * CC="clang" CFLAGS="-fsanitize=address,fuzzer -O2 -g" ./configure --prefix=/usr --libdir=/usr/lib64
 * make -k
	(the executables do not build with -fsanitize=fuzzer due to duplicate main)
 * make -k install
 * clang -fsanitize=address,fuzzer -O2 -g sample-libfuzz.c autodetect.c context.c -lgphoto2 -lgphoto2_port -o fuzzer
 * mkdir CORPUS
 * ./fuzzer -detect_leaks=0 CORPUS/
 *
 * FIXME:
 * - currently this seems to have memory leaks, it slows down and gets more and more memory over time. 
 *   restarting cures it for a while
 * - It crashes on start in 80% of the cases. You might need retry multiple times to start it.
 *   reason is i think the fuzzer creates a bitmap in an area where the loaded camlibs are mapped into after the fact.
 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

#include <gphoto2/gphoto2-camera.h><commit_msg>better comments<commit_after>/*
 * This is a sample for use by LibFuzzer.
 *
 * How to build:
 * install clang
 * CC="clang" CFLAGS="-fsanitize=address,fuzzer-no-link -O2 -g" ./configure --prefix=/usr --libdir=/usr/lib64 --enable-vusb
 * make
 * sudo make install
 * rm usb1.* from port drivers
 * in examples/
 * clang -fsanitize=address,fuzzer -O2 -g sample-libfuzz.c autodetect.c context.c -lgphoto2 -lgphoto2_port -o fuzzer
 * mkdir CORPUS
 * ./fuzzer -detect_leaks=0 CORPUS/
 *
 * FIXME:
 * - currently this seems to have memory leaks, it slows down and gets more and more memory over time. 
 *   restarting cures it for a while
 * - It crashes on start in 80% of the cases. You might need retry multiple times to start it.
 *   reason is i think the fuzzer creates a bitmap in an area where the loaded camlibs are mapped into after the fact.
 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

#include <gphoto2/gphoto2-camera.h>
{'fraction_non_alphanumeric': 0.10613086038124678, 'fraction_numerical': 0.01184956208140134, 'mean_word_length': 3.464367816091954, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7428388', 'n_tokens_mistral': 686, 'n_tokens_neox': 662, 'n_words': 252}