From 73e8bc41cd0a9f109dac02838ceee0e7ce58d504 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 9 Jan 2020 16:15:04 +1100 Subject: [PATCH] [c-host] don't overflow the pointerMemory array --- LGMP | 2 +- c-host/src/app.c | 8 +++----- common/include/common/KVMFR.h | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/LGMP b/LGMP index 7e02dfd8..f941a676 160000 --- a/LGMP +++ b/LGMP @@ -1 +1 @@ -Subproject commit 7e02dfd8ec53385cab76c819ab33a90911c6a271 +Subproject commit f941a676c87de15e75f7d62c77ba0a7dca314158 diff --git a/c-host/src/app.c b/c-host/src/app.c index 6df1cf7a..c836b25e 100644 --- a/c-host/src/app.c +++ b/c-host/src/app.c @@ -39,10 +39,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA #define ALIGN_DN(x) ((uintptr_t)(x) & ~0x7F) #define ALIGN_UP(x) ALIGN_DN(x + 0x7F) -#define LGMP_Q_POINTER 1 #define LGMP_Q_POINTER_LEN 10 -#define LGMP_Q_FRAME 2 -#define LGMP_Q_FRAME_LEN 2 +#define LGMP_Q_FRAME_LEN 2 #define MAX_POINTER_SIZE (sizeof(KVMFRCursor) + (128 * 128 * 4)) @@ -301,7 +299,7 @@ void capturePostPointerBuffer(CapturePointer pointer) return; } - if (app.pointerIndex++ == LGMP_Q_POINTER_LEN) + if (++app.pointerIndex == LGMP_Q_POINTER_LEN) app.pointerIndex = 0; } @@ -390,7 +388,7 @@ int app_main(int argc, char * argv[]) } } - DEBUG_INFO("Max Pointer Size : %u KiB", (unsigned int)MAX_POINTER_SIZE); + DEBUG_INFO("Max Pointer Size : %u KiB", (unsigned int)MAX_POINTER_SIZE / 1024); DEBUG_INFO("Max Frame Size : %u MiB", (unsigned int)(app.maxFrameSize / 1048576LL)); CaptureInterface * iface = NULL; diff --git a/common/include/common/KVMFR.h b/common/include/common/KVMFR.h index b6b52d81..3b39420a 100644 --- a/common/include/common/KVMFR.h +++ b/common/include/common/KVMFR.h @@ -20,8 +20,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include -#define KVMFR_HEADER_MAGIC "[[KVMFR]]" -#define KVMFR_HEADER_VERSION 9 +#define LGMP_Q_POINTER 1 +#define LGMP_Q_FRAME 2 typedef enum FrameType {