realmadsci 1d9a3d955c
Fix memory errors when trim causes testcase growth (#881) (#903)
* Revert "fixed potential double free in custom trim (#881)"

This reverts commit e9d2f72382cab75832721d859c3e731da071435d.

* Revert "fix custom trim for increasing data"

This reverts commit 86a8ef168dda766d2f25f15c15c4d3ecf21d0667.

* Fix memory errors when trim causes testcase growth

Modify trim_case_custom to avoid writing into in_buf because
some custom mutators can cause the testcase to grow rather than
shrink.

Instead of modifying in_buf directly, we write the update out
to the disk when trimming is complete, and then the caller is
responsible for refreshing the in-memory buffer from the file.

This is still a bit sketchy because it does need to modify q->len in
order to notify the upper layers that something changed, and it could
end up telling upper layer code that the q->len is *bigger* than
the buffer (q->testcase_buf) that contains it, which is asking
for trouble down the line somewhere...

* Fix an unlikely situation

Put back some `unlikely()` calls that were in
the e9d2f72382cab75832721d859c3e731da071435d commit that was
reverted.
2021-05-07 00:14:16 +02:00
..
2020-12-23 17:56:39 +01:00
2021-04-04 20:05:02 +02:00
2021-03-23 18:47:07 +01:00
2021-02-05 10:47:16 +01:00
2021-02-05 10:47:16 +01:00
2021-01-15 16:56:40 +01:00
2021-04-28 10:25:26 +02:00
2021-03-25 20:10:09 +01:00
2020-06-28 23:50:25 +02:00
2021-02-01 12:01:23 +01:00
2020-07-30 18:06:25 +02:00
2021-01-31 17:32:24 +01:00