From 55a24c27a2908c8275b92f5d71fd644748d8fccc Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Wed, 30 Aug 2023 16:28:12 +0300 Subject: [PATCH] uaedbg allocation limit check --- debugmem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/debugmem.cpp b/debugmem.cpp index ac15b80e..b1fd1c55 100644 --- a/debugmem.cpp +++ b/debugmem.cpp @@ -915,6 +915,10 @@ static struct debugmemallocs *debugmem_allocate(uae_u32 size, uae_u32 flags, uae struct debugmemallocs *dm = getallocblock(); if (!dm) return NULL; + if (size >= totalmemdata) { + console_out_f(_T("debugmem allocation larger than free space! Alloc size %d (%08x), flags %08x\n"), size, size, flags); + return 0; + } int offset = debugmemptr / PAGE_SIZE; bool gotit = true; int totalsize = 0; @@ -947,7 +951,7 @@ static struct debugmemallocs *debugmem_allocate(uae_u32 size, uae_u32 flags, uae break; } if (!gotit || !totalsize || !extrasize) { - console_out_f(_T("debugmem out of free space! Alloc size %d, flags %08x\n"), size, flags); + console_out_f(_T("debugmem out of free space! Alloc size %d (%08x), flags %08x\n"), size, size, flags); return 0; } dm->parentid = parentid; -- 2.47.3