Core: Fix mVL state size discrepancies

This commit is contained in:
Vicki Pfau 2017-08-03 18:44:26 -07:00
parent 51a6079e91
commit 35a13753bb
1 changed files with 10 additions and 2 deletions

View File

@ -687,8 +687,16 @@ void mVideoLogContextDestroy(struct mCore* core, struct mVideoLogContext* contex
void mVideoLogContextRewind(struct mVideoLogContext* context, struct mCore* core) {
_readHeader(context);
if (core && core->stateSize(core) == context->initialStateSize) {
core->loadState(core, context->initialState);
if (core) {
size_t size = core->stateSize(core);
if (size <= context->initialStateSize) {
core->loadState(core, context->initialState);
} else {
void* extendedState = anonymousMemoryMap(size);
memcpy(extendedState, context->initialState, context->initialStateSize);
core->loadState(core, extendedState);
mappedMemoryFree(extendedState, size);
}
}
off_t pointer = context->backing->seek(context->backing, 0, SEEK_CUR);