Core: Fix mVL state size discrepancies
Vicki Pfau vi@endrift.com
Thu, 03 Aug 2017 18:44:26 -0700
1 files changed,
10 insertions(+),
2 deletions(-)
jump to
M
src/feature/video-logger.c
→
src/feature/video-logger.c
@@ -687,8 +687,16 @@ }
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);