From 35a13753bb414253c5901013b3dcc1b05ff9dc6c Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 3 Aug 2017 18:44:26 -0700 Subject: [PATCH] Core: Fix mVL state size discrepancies --- src/feature/video-logger.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/feature/video-logger.c b/src/feature/video-logger.c index ab071512d..6d9710872 100644 --- a/src/feature/video-logger.c +++ b/src/feature/video-logger.c @@ -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);