From: Toni Wilen Date: Wed, 30 Aug 2023 13:28:12 +0000 (+0300) Subject: uaedbg allocation limit check X-Git-Tag: 5.1.0~132 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=55a24c27a2908c8275b92f5d71fd644748d8fccc;p=francis%2Fwinuae.git uaedbg allocation limit check --- 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;