Changeset 77544 in vbox for trunk/src/VBox/Runtime/common/fuzz/fuzz.cpp
- Timestamp:
- Mar 3, 2019 8:07:01 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129148
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fuzz/fuzz.cpp
r77514 r77544 190 190 /** Size of the mutation dependent data. */ 191 191 size_t cbMutation; 192 /** Flag whether the mutation is contained in the tree of the context. */ 193 bool fInTree; 192 194 /** Mutation dependent data, variable in size. */ 193 195 uint8_t abMutation[1]; … … 471 473 472 474 /** 475 * Destroys the given mutation. 476 * 477 * @returns nothing. 478 * @param pMutation The mutation to destroy. 479 */ 480 static void rtFuzzMutationDestroy(PRTFUZZMUTATION pMutation) 481 { 482 rtFuzzCtxMemoryFree(pMutation->pFuzzer, pMutation); 483 } 484 485 486 /** 473 487 * Retains an external reference to the given mutation. 474 488 * … … 479 493 { 480 494 uint32_t cRefs = ASMAtomicIncU32(&pMutation->cRefs); 481 AssertMsg(cRefs > 1 && cRefs < _1M, ("%#x %p\n", cRefs, pMutation)); 495 AssertMsg( ( cRefs > 1 496 || pMutation->fInTree) 497 && cRefs < _1M, ("%#x %p\n", cRefs, pMutation)); 482 498 return cRefs; 483 499 } 484 500 485 501 486 #if 0 /* unused */487 502 /** 488 503 * Releases an external reference from the given mutation. … … 495 510 uint32_t cRefs = ASMAtomicDecU32(&pMutation->cRefs); 496 511 AssertMsg(cRefs < _1M, ("%#x %p\n", cRefs, pMutation)); 512 if (cRefs == 0 && !pMutation->fInTree) 513 rtFuzzMutationDestroy(pMutation); 497 514 return cRefs; 498 515 } 499 #endif500 516 501 517 … … 519 535 AssertRC(rc); RT_NOREF(rc); 520 536 537 pMutation->fInTree = true; 521 538 return rc; 522 539 } … … 531 548 static PRTFUZZMUTATION rtFuzzCtxMutationPickRnd(PRTFUZZCTXINT pThis) 532 549 { 533 uint64_t idxMutation = RTRandAdvU64Ex(pThis->hRand, 0, ASMAtomicReadU64(&pThis->cMutations));550 uint64_t idxMutation = RTRandAdvU64Ex(pThis->hRand, 1, ASMAtomicReadU64(&pThis->cMutations)); 534 551 535 552 int rc = RTSemRWRequestRead(pThis->hSemRwMutations, RT_INDEFINITE_WAIT); … … 575 592 pMutation->pMutationParent = pMutationParent; 576 593 pMutation->cbMutation = cbAdditional; 594 pMutation->fInTree = false; 577 595 578 596 if (pMutationParent) … … 583 601 584 602 return pMutation; 585 }586 587 588 /**589 * Destroys the given mutation.590 *591 * @returns nothing.592 * @param pMutation The mutation to destroy.593 */594 static void rtFuzzMutationDestroy(PRTFUZZMUTATION pMutation)595 {596 rtFuzzCtxMemoryFree(pMutation->pFuzzer, pMutation);597 603 } 598 604 … … 888 894 rtFuzzCtxMemoryFree(pFuzzer, pThis->u.Blob.pvInput); 889 895 896 rtFuzzMutationRelease(pThis->pMutationTop); 890 897 rtFuzzCtxMemoryFree(pFuzzer, pThis); 891 898 RTFuzzCtxRelease(pFuzzer);
Note:
See TracChangeset
for help on using the changeset viewer.