Changeset 72454 in vbox for trunk/include
- Timestamp:
- Jun 5, 2018 7:32:45 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 122935
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/fuzz.h
r72436 r72454 34 34 /** @defgroup grp_rt_fuzz RTFuzz - Data fuzzing framework 35 35 * @ingroup grp_rt 36 * @sa grp_rt_test 36 37 * @{ 37 38 */ 38 39 39 40 40 /** A fuzzer context handle. */ 41 typedef struct RTFUZZCTXINT *RTFUZZCTX;41 typedef struct RTFUZZCTXINT *RTFUZZCTX; 42 42 /** Pointer to a fuzzer context handle. */ 43 typedef RTFUZZCTX *PRTFUZZCTX;44 /** NIL Fuzzer context handle. */45 #define NIL_RTFUZZCTX ((RTFUZZCTX)~(uintptr_t)0)43 typedef RTFUZZCTX *PRTFUZZCTX; 44 /** NIL fuzzer context handle. */ 45 #define NIL_RTFUZZCTX ((RTFUZZCTX)~(uintptr_t)0) 46 46 /** A fuzzer input handle. */ 47 typedef struct RTFUZZINPUTINT *RTFUZZINPUT;47 typedef struct RTFUZZINPUTINT *RTFUZZINPUT; 48 48 /** Pointer to a fuzzer input handle. */ 49 typedef RTFUZZINPUT *PRTFUZZINPUT;50 /** NIL Fuzzer input handle. */51 #define NIL_RTFUZZINPUT ((RTFUZZINPUT)~(uintptr_t)0)49 typedef RTFUZZINPUT *PRTFUZZINPUT; 50 /** NIL fuzzer input handle. */ 51 #define NIL_RTFUZZINPUT ((RTFUZZINPUT)~(uintptr_t)0) 52 52 53 53 54 54 /** Fuzzing observer handle. */ 55 typedef struct RTFUZZOBSINT *RTFUZZOBS;55 typedef struct RTFUZZOBSINT *RTFUZZOBS; 56 56 /** Pointer to a fuzzing observer handle. */ 57 typedef RTFUZZOBS *PRTFUZZOBS;57 typedef RTFUZZOBS *PRTFUZZOBS; 58 58 /** NIL fuzzing observer handle. */ 59 #define NIL_RTFUZZOBS ((RTFUZZOBS)~(uintptr_t)0)59 #define NIL_RTFUZZOBS ((RTFUZZOBS)~(uintptr_t)0) 60 60 61 61 … … 76 76 RTDECL(int) RTFuzzCtxCreate(PRTFUZZCTX phFuzzCtx); 77 77 78 79 78 /** 80 79 * Creates a new fuzzing context from the given state. … … 87 86 RTDECL(int) RTFuzzCtxCreateFromState(PRTFUZZCTX phFuzzCtx, const void *pvState, size_t cbState); 88 87 89 90 88 /** 91 89 * Creates a new fuzzing context loading the state from the given file. … … 97 95 RTDECL(int) RTFuzzCtxCreateFromStateFile(PRTFUZZCTX phFuzzCtx, const char *pszFilename); 98 96 99 100 97 /** 101 98 * Retains a reference to the given fuzzing context. … … 106 103 RTDECL(uint32_t) RTFuzzCtxRetain(RTFUZZCTX hFuzzCtx); 107 104 108 109 105 /** 110 106 * Releases a reference from the given fuzzing context, destroying it when reaching 0. … … 114 110 */ 115 111 RTDECL(uint32_t) RTFuzzCtxRelease(RTFUZZCTX hFuzzCtx); 116 117 112 118 113 /** … … 126 121 RTDECL(int) RTFuzzCtxStateExport(RTFUZZCTX hFuzzCtx, void **ppvState, size_t *pcbState); 127 122 128 129 123 /** 130 124 * Exports the given fuzzing context state to the given file. … … 136 130 RTDECL(int) RTFuzzCtxStateExportToFile(RTFUZZCTX hFuzzCtx, const char *pszFilename); 137 131 138 139 132 /** 140 133 * Adds a new seed to the input corpus of the given fuzzing context. … … 147 140 RTDECL(int) RTFuzzCtxCorpusInputAdd(RTFUZZCTX hFuzzCtx, const void *pvInput, size_t cbInput); 148 141 149 150 142 /** 151 143 * Adds a new seed to the input corpus of the given fuzzing context from the given file. … … 157 149 RTDECL(int) RTFuzzCtxCorpusInputAddFromFile(RTFUZZCTX hFuzzCtx, const char *pszFilename); 158 150 159 160 151 /** 161 152 * Adds new seeds to the input corpus of the given fuzzing context from the given directory. 162 153 * 154 * Will only process regular files, i.e. ignores directories, symbolic links, devices, fifos 155 * and such. 156 * 163 157 * @returns IPRT status code. 164 158 * @param hFuzzCtx The fuzzing context handle. … … 167 161 RTDECL(int) RTFuzzCtxCorpusInputAddFromDirPath(RTFUZZCTX hFuzzCtx, const char *pszDirPath); 168 162 169 170 163 /** 171 164 * Restricts the maximum input size to generate by the fuzzing context. … … 177 170 RTDECL(int) RTFuzzCtxCfgSetInputSeedMaximum(RTFUZZCTX hFuzzCtx, size_t cbMax); 178 171 179 180 172 /** 181 173 * Returns the maximum input size of the given fuzzing context. … … 186 178 RTDECL(size_t) RTFuzzCtxCfgGetInputSeedMaximum(RTFUZZCTX hFuzzCtx); 187 179 188 189 180 /** 190 181 * Sets flags controlling the behavior of the fuzzing context. … … 192 183 * @returns IPRT status code. 193 184 * @param hFuzzCtx The fuzzing context handle. 194 * @param fFlags Flags controlling the fuzzing context .185 * @param fFlags Flags controlling the fuzzing context, RTFUZZCTX_F_XXX. 195 186 */ 196 187 RTDECL(int) RTFuzzCtxCfgSetBehavioralFlags(RTFUZZCTX hFuzzCtx, uint32_t fFlags); 197 188 198 199 189 /** 200 190 * Returns the current set behavioral flags for the given fuzzing context. … … 205 195 RTDECL(uint32_t) RTFuzzCfgGetBehavioralFlags(RTFUZZCTX hFuzzCtx); 206 196 207 208 197 /** 209 198 * Sets the temporary directory used by the fuzzing context. … … 215 204 RTDECL(int) RTFuzzCtxCfgSetTmpDirectory(RTFUZZCTX hFuzzCtx, const char *pszPathTmp); 216 205 217 218 206 /** 219 207 * Returns the current temporary directory. … … 234 222 235 223 224 236 225 /** 237 226 * Retains a reference to the given fuzzing input handle. … … 242 231 RTDECL(uint32_t) RTFuzzInputRetain(RTFUZZINPUT hFuzzInput); 243 232 244 245 233 /** 246 234 * Releases a reference from the given fuzzing input handle, destroying it when reaaching 0. … … 250 238 */ 251 239 RTDECL(uint32_t) RTFuzzInputRelease(RTFUZZINPUT hFuzzInput); 252 253 240 254 241 /** … … 262 249 RTDECL(int) RTFuzzInputQueryData(RTFUZZINPUT hFuzzInput, void **ppv, size_t *pcb); 263 250 264 265 251 /** 266 252 * Queries the string of the MD5 digest for the given fuzzed input. … … 274 260 RTDECL(int) RTFuzzInputQueryDigestString(RTFUZZINPUT hFuzzInput, char *pszDigest, size_t cchDigest); 275 261 276 277 262 /** 278 263 * Writes the given fuzzing input to the given file. … … 284 269 RTDECL(int) RTFuzzInputWriteToFile(RTFUZZINPUT hFuzzInput, const char *pszFilename); 285 270 286 287 271 /** 288 272 * Adds the given fuzzed input to the input corpus of the owning context. … … 294 278 RTDECL(int) RTFuzzInputAddToCtxCorpus(RTFUZZINPUT hFuzzInput); 295 279 296 297 280 /** 298 281 * Removes the given fuzzed input from the input corpus of the owning context. … … 305 288 306 289 290 307 291 /** 308 292 * Creates a new fuzzing observer. … … 313 297 RTDECL(int) RTFuzzObsCreate(PRTFUZZOBS phFuzzObs); 314 298 315 316 299 /** 317 300 * Destroys a previously created fuzzing observer. … … 322 305 RTDECL(int) RTFuzzObsDestroy(RTFUZZOBS hFuzzObs); 323 306 324 325 307 /** 326 308 * Queries the internal fuzzing context of the given observer. … … 334 316 RTDECL(int) RTFuzzObsQueryCtx(RTFUZZOBS hFuzzObs, PRTFUZZCTX phFuzzCtx); 335 317 336 337 318 /** 338 319 * Sets the temp directory for the given fuzzing observer. … … 344 325 RTDECL(int) RTFuzzObsSetTmpDirectory(RTFUZZOBS hFuzzObs, const char *pszTmp); 345 326 346 347 327 /** 348 328 * Sets the binary to run for each fuzzed input. … … 351 331 * @param hFuzzObs The fuzzing observer handle. 352 332 * @param pszBinary The binary path. 353 * @param fFlags Flags controlling execution of the binary .333 * @param fFlags Flags controlling execution of the binary, RTFUZZ_OBS_BINARY_F_XXX. 354 334 */ 355 335 RTDECL(int) RTFuzzObsSetTestBinary(RTFUZZOBS hFuzzObs, const char *pszBinary, uint32_t fFlags); 356 336 337 /** @name RTFUZZ_OBS_BINARY_F_XXX 338 * @{ */ 357 339 /** The tested binary requires a real file to read from and doesn't support stdin. */ 358 #define RTFUZZ_OBS_BINARY_F_INPUT_FILE RT_BIT_32(0) 340 #define RTFUZZ_OBS_BINARY_F_INPUT_FILE RT_BIT_32(0) 341 /** @} */ 359 342 360 343 /** … … 368 351 RTDECL(int) RTFuzzObsSetTestBinaryArgs(RTFUZZOBS hFuzzObs, const char * const *papszArgs, unsigned cArgs); 369 352 370 371 353 /** 372 354 * Starts fuzzing the set binary. … … 378 360 */ 379 361 RTDECL(int) RTFuzzObsExecStart(RTFUZZOBS hFuzzObs, uint32_t cProcs); 380 381 362 382 363 /** … … 399 380 */ 400 381 RTR3DECL(RTEXITCODE) RTFuzzCmdMaster(unsigned cArgs, char **papszArgs); 382 401 383 /** @} */ 402 384
Note:
See TracChangeset
for help on using the changeset viewer.