VirtualBox

Changeset 83266 in vbox for trunk/include


Ignore:
Timestamp:
Mar 11, 2020 6:38:31 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
136418
Message:

Runtime/common/fuzz: Add API to specify the range in an input corpus where mutations are allowed, global and per input. Allows fuzzing certain interesting areas which might not be reached that often otherwise

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/fuzz.h

    r82968 r83266  
    274274
    275275/**
     276 * Adds a new seed to the input corpus of the given fuzzing context - extended version.
     277 *
     278 * @returns IPRT status code.
     279 * @param   hFuzzCtx            The fuzzing context handle.
     280 * @param   pvInput             The pointer to the input buffer.
     281 * @param   cbInput             Size of the input buffer.
     282 * @param   offMutStart         Start offset at which a mutation can happen.
     283 * @param   cbMutRange          Size of the range in bytes where a mutation can happen,
     284 *                              use UINT64_MAX to allow mutations till the end of the input.
     285 */
     286RTDECL(int) RTFuzzCtxCorpusInputAddEx(RTFUZZCTX hFuzzCtx, const void *pvInput, size_t cbInput,
     287                                      uint64_t offMutStart, uint64_t cbMutRange);
     288
     289/**
    276290 * Adds a new seed to the input corpus of the given fuzzing context from the given file.
    277291 *
     
    283297
    284298/**
     299 * Adds a new seed to the input corpus of the given fuzzing context from the given file - extended version.
     300 *
     301 * @returns IPRT status code.
     302 * @param   hFuzzCtx            The fuzzing context handle.
     303 * @param   pszFilename         The filename to load the seed from.
     304 * @param   offMutStart         Start offset at which a mutation can happen.
     305 * @param   cbMutRange          Size of the range in bytes where a mutation can happen,
     306 *                              use UINT64_MAX to allow mutations till the end of the input.
     307 */
     308RTDECL(int) RTFuzzCtxCorpusInputAddFromFileEx(RTFUZZCTX hFuzzCtx, const char *pszFilename,
     309                                              uint64_t offMutStart, uint64_t cbMutRange);
     310
     311/**
    285312 * Adds a new seed to the input corpus of the given fuzzing context from the given VFS file.
    286313 *
     
    290317 */
    291318RTDECL(int) RTFuzzCtxCorpusInputAddFromVfsFile(RTFUZZCTX hFuzzCtx, RTVFSFILE hVfsFile);
     319
     320/**
     321 * Adds a new seed to the input corpus of the given fuzzing context from the given VFS file - extended version.
     322 *
     323 * @returns IPRT status code.
     324 * @param   hFuzzCtx            The fuzzing context handle.
     325 * @param   hVfsFile            The VFS file handle to load the seed from.
     326 * @param   offMutStart         Start offset at which a mutation can happen.
     327 * @param   cbMutRange          Size of the range in bytes where a mutation can happen,
     328 *                              use UINT64_MAX to allow mutations till the end of the input.
     329 */
     330RTDECL(int) RTFuzzCtxCorpusInputAddFromVfsFileEx(RTFUZZCTX hFuzzCtx, RTVFSFILE hVfsFile,
     331                                                 uint64_t offMutStart, uint64_t cbMutRange);
    292332
    293333/**
     
    353393 */
    354394RTDECL(const char *) RTFuzzCtxCfgGetTmpDirectory(RTFUZZCTX hFuzzCtx);
     395
     396/**
     397 * Sets the range in which a particular input can get mutated.
     398 *
     399 * @returns IPRT status code.
     400 * @param   hFuzzCtx            The fuzzing context handle.
     401 * @param   offStart            Start offset at which a mutation can happen.
     402 * @param   cbRange             Size of the range in bytes where a mutation can happen,
     403 *                              use UINT64_MAX to allow mutations till the end of the input.
     404 */
     405RTDECL(int) RTFuzzCtxCfgSetMutationRange(RTFUZZCTX hFuzzCtx, uint64_t offStart, uint64_t cbRange);
    355406
    356407/**
  • trunk/include/iprt/mangling.h

    r82699 r83266  
    10431043# define RTFuzzCtxCfgSetBehavioralFlags                 RT_MANGLER(RTFuzzCtxCfgSetBehavioralFlags)
    10441044# define RTFuzzCtxCfgSetInputSeedMaximum                RT_MANGLER(RTFuzzCtxCfgSetInputSeedMaximum)
     1045# define RTFuzzCtxCfgSetMutationRange                   RT_MANGLER(RTFuzzCtxCfgSetMutationRange)
    10451046# define RTFuzzCtxCfgSetTmpDirectory                    RT_MANGLER(RTFuzzCtxCfgSetTmpDirectory)
    10461047# define RTFuzzCtxCorpusInputAdd                        RT_MANGLER(RTFuzzCtxCorpusInputAdd)
     1048# define RTFuzzCtxCorpusInputAddEx                        RT_MANGLER(RTFuzzCtxCorpusInputAddEx)
    10471049# define RTFuzzCtxCorpusInputAddFromDirPath             RT_MANGLER(RTFuzzCtxCorpusInputAddFromDirPath)
    10481050# define RTFuzzCtxCorpusInputAddFromFile                RT_MANGLER(RTFuzzCtxCorpusInputAddFromFile)
     1051# define RTFuzzCtxCorpusInputAddFromFileEx              RT_MANGLER(RTFuzzCtxCorpusInputAddFromFileEx)
    10491052# define RTFuzzCtxCorpusInputAddFromVfsFile             RT_MANGLER(RTFuzzCtxCorpusInputAddFromVfsFile)
     1053# define RTFuzzCtxCorpusInputAddFromVfsFileEx           RT_MANGER(RTFuzzCtxCorpusInputAddFromVfsFileEx)
    10501054# define RTFuzzCtxCreate                                RT_MANGLER(RTFuzzCtxCreate)
    10511055# define RTFuzzCtxCreateFromState                       RT_MANGLER(RTFuzzCtxCreateFromState)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette