Revert "warn instead of assert on case where MemPatch application would exceed size of target buffer (which should never happen, if you're applying the patch to the same type it was generated from)"

This reverts commit ea02a913b2.
This commit is contained in:
tildearrow 2024-08-19 02:49:14 -05:00
parent 251be67b69
commit 257abca831

View file

@ -17,6 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <cassert>
#include "dataErrors.h" #include "dataErrors.h"
#include "engine.h" #include "engine.h"
#include "instrument.h" #include "instrument.h"
@ -399,11 +400,7 @@ bool MemPatch::calcDiff(const void* pre, const void* post, size_t inputSize) {
void MemPatch::applyAndReverse(void* target, size_t targetSize) { void MemPatch::applyAndReverse(void* target, size_t targetSize) {
if (size==0) return; if (size==0) return;
if (offset+size>targetSize) { assert(offset+size<=targetSize);
logW("MemPatch (offset %d, size %d) exceeds target size (%d), can't apply!",offset,size,targetSize);
return;
}
unsigned char* targetBytes=(unsigned char*)target; unsigned char* targetBytes=(unsigned char*)target;
// swap this->data and its segment on target // swap this->data and its segment on target