Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.

fixed shrinking vector and un-mutated primitives #6

Open
Knight-Ops wants to merge 4 commits intomicrosoft:masterfrom
Knight-Ops:master
Open

fixed shrinking vector and un-mutated primitives #6
Knight-Ops wants to merge 4 commits intomicrosoft:masterfrom
Knight-Ops:master

Conversation

@Knight-Ops
Copy link

This fixes an issues with Vec<_> mutation where the mutator can actually try to remove more bytes than exist in the vector. This causes a panic.

The fix here is pretty simple, we just take the min of the length of the vector or the randomly generated range.

@msftclas
Copy link

msftclas commented Sep 6, 2019

CLA assistant check
All CLA requirements met.

@Knight-Ops Knight-Ops changed the title fixed shrinking vector fixed shrinking vector and un-mutated primitives Sep 6, 2019
@Knight-Ops
Copy link
Author

Knight-Ops commented Sep 6, 2019

New changes include :

Cargo.toml : Adding env_logger and log as dependencies just so you have easier access to trace and debug information

mutator.rs : Added a setter for target_total_fields so that we can actually set the size of the structure instead of setting it always to 1 (Seems like it fell through the cracks). Added a Havoc random field selector, as it stands currently, Havoc will only ever mutate the last field in the structure (for primitive integers, other types of fields are mutated differently).

mutation.rs : Added code generation for setting the actual number of fields of the structure being fuzzed this allows us to actually fuzz each field and not guess later how large the structure is.

EDIT: Removed previous change of targeted_field_idx increment movement

@Knight-Ops Knight-Ops mentioned this pull request Sep 6, 2019
@Knight-Ops
Copy link
Author

New changes include:

mutator.rs : Added support for nested structure that are properly mutated with a simple fix of AddAssign the total number of fields to target

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants