Commit ebf207a
committed
fix: make sure ConsumeIntegralInRange is always in range [min; max]
For cases where FuzzedDataProvider.consume<Byte,Short,Char,Integer,Long>(from,
to) sets the range [from; to] to be exactly the maximum value for the type, this
methods could return values outside the requested range. This PR makes sure that
the returned values are always in range.
In addition, this PR boost the performance of these methods by making less use
of the modulo operator to reduce fuzzer values into the range. Keeping the
number "as is" allows the fuzzer to use the table of recent compares more
efficiently. At the same time, this change might invalidate existing crash files
and some corpus entries. However, given overall performance boost this change
brings, the potential corpus invalidation is considered less important.1 parent c733606 commit ebf207a
1 file changed
Lines changed: 9 additions & 7 deletions
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| |||
0 commit comments