Go to the documentation of this file.
36 const uint8_t
separator[] = {0x01, 0xD5, 0xCA, 0x7A};
43 char *target_suffix = strrchr((*argv)[0],
'_');
44 if (target_suffix != NULL) {
53 const char *forceLayerStr = getenv(
"FUZZ_APPLAYER");
57 printf(
"Invalid numeric value for FUZZ_APPLAYER environment variable");
70 #define ALPROTO_MAXTX 4096
76 const uint8_t * albuffer;
81 uint8_t * isolatedBuffer;
85 setenv(
"SC_LOG_OP_IFACE",
"file", 0);
86 setenv(
"SC_LOG_FILE",
"/dev/null", 0);
117 f->
src.addr_data32[0] = 0x01020304;
118 f->
dst.addr_data32[0] = 0x05060708;
119 f->
sp = (uint16_t)((data[2] << 8) | data[3]);
120 f->
dp = (uint16_t)((data[4] << 8) | data[5]);
140 uint8_t
flags = STREAM_START;
142 alnext = memmem(albuffer, alsize,
separator, 4);
145 flags |= STREAM_TOCLIENT;
146 flags &= ~(STREAM_TOSERVER);
149 flags |= STREAM_TOSERVER;
150 flags &= ~(STREAM_TOCLIENT);
154 if (alnext != albuffer) {
156 isolatedBuffer = malloc(alnext - albuffer);
157 if (isolatedBuffer == NULL) {
160 memcpy(isolatedBuffer, albuffer, alnext - albuffer);
162 free(isolatedBuffer);
168 flags &= ~(STREAM_START);
170 (((
flags & STREAM_TOSERVER) != 0 &&
172 ((
flags & STREAM_TOCLIENT) != 0 &&
181 alsize -= alnext - albuffer + 4;
182 albuffer = alnext + 4;
186 alnext = memmem(albuffer, alsize,
separator, 4);
190 flags |= STREAM_TOCLIENT;
191 flags &= ~(STREAM_TOSERVER);
194 flags |= STREAM_TOSERVER;
195 flags &= ~(STREAM_TOCLIENT);
199 isolatedBuffer = malloc(alsize);
200 if (isolatedBuffer == NULL) {
203 memcpy(isolatedBuffer, albuffer, alsize);
205 free(isolatedBuffer);
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir)
remove obsolete (inspected and logged) transactions
int ByteExtractStringUint16(uint16_t *res, int base, size_t len, const char *str)
int LLVMFuzzerInitialize(int *argc, char ***argv)
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
void GlobalsInitPreConfig(void)
#define APP_LAYER_PARSER_EOF_TS
#define FLOWLOCK_UNLOCK(fb)
AppLayerParserState * alparser
const uint8_t separator[]
AppLayerParserThreadCtx * alp_tctx
AppProto StringToAppProto(const char *proto_name)
Maps a string to its ALPROTO_* equivalent.
#define FLOWLOCK_WRLOCK(fb)
int ConfYamlLoadString(const char *string, size_t len)
Load configuration from a YAML string.
int PostConfLoadedSetup(SCInstance *suri)
uint8_t FlowGetProtoMapping(uint8_t proto)
Function to map the protocol to the defined FLOW_PROTO_* enumeration.
#define APP_LAYER_PARSER_EOF_TC
void setenv(const char *name, const char *value, int overwrite)
AppLayerParserThreadCtx * AppLayerParserThreadCtxAlloc(void)
Gets a new app layer protocol's parser thread context.
int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow *f, AppProto alproto, uint8_t flags, const uint8_t *input, uint32_t input_len)
void FlowFree(Flow *f)
cleanup & free the memory of a flow
const char configNoChecksum[]
TmEcode ConfigSetLogDirectory(const char *name)
SC_ATOMIC_EXTERN(unsigned int, engine_stage)
int InitGlobal(void)
Global initialization common to all runmodes.
int FlowChangeProto(Flow *f)
Check if change proto flag is set for flow.
Flow * FlowAlloc(void)
allocate a flow
uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag)
AppProto alproto
application level protocol
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)