mangle: remove explicit Append as it inflates files too much
@@ -82,6 +82,11 @@ static inline size_t mangle_getOffSet(run_t* run) {
return mangle_getLen(run->dynfile->size) - 1;
}
+/* Offset which can be equal to the file size */
+static inline size_t mangle_getOffSetPlus1(run_t* run) {
+ return mangle_getLen(run->dynfile->size + 1) - 1;
+}
+
static inline void mangle_Move(run_t* run, size_t off_from, size_t off_to, size_t len) {
if (off_from >= run->dynfile->size) {
return;
@@ -141,22 +146,11 @@ static inline void mangle_Insert(
mangle_Overwrite(run, off, val, len, printable);
}
-static inline void mangle_Append(run_t* run, const uint8_t* val, size_t len, bool printable) {
- size_t localOff = run->dynfile->size;
- mangle_Insert(run, localOff, val, len, printable);
-}
-
static inline void mangle_UseValue(run_t* run, const uint8_t* val, size_t len, bool printable) {
- switch (util_rnd64() % 3) {
- case 0:
- mangle_Insert(run, mangle_getOffSet(run), val, len, printable);
- break;
- case 1:
+ if (util_rnd64() % 2) {
+ mangle_Insert(run, mangle_getOffSetPlus1(run), val, len, printable);
+ } else {
mangle_Overwrite(run, mangle_getOffSet(run), val, len, printable);
- break;
- case 2:
- mangle_Append(run, val, len, printable);
- break;
}
}
