Skip to content

Commit be49d64

Browse files
committed
Devices/Graphics: COTable grow: use size of old COTable. bugref:11124
svn:sync-xref-src-repo-rev: r174548
1 parent fa4da15 commit be49d64

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: DevVGA-SVGA3d-dx.cpp 114297 2026-06-09 14:06:22Z vitali.pelenjow@oracle.com $ */
1+
/* $Id: DevVGA-SVGA3d-dx.cpp 114712 2026-07-15 17:24:33Z vitali.pelenjow@oracle.com $ */
22
/** @file
33
* DevSVGA3d - VMWare SVGA device, 3D parts - Common code for DX backend interface.
44
*/
@@ -2884,11 +2884,13 @@ static int dxSetOrGrowCOTable(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext
28842884

28852885
/* Set the new host buffer and remember the old host buffer. */
28862886
void *pvOldCOT = NULL;
2887+
uint32_t cbOldCOT = 0;
28872888
switch (enmType)
28882889
{
28892890
# define CASE_DX_COT(_COTName, _COTEntryType, _COTField) \
28902891
case _COTName: \
28912892
pvOldCOT = pDXContext->cot.pa ## _COTField; \
2893+
cbOldCOT = pDXContext->cot.c ## _COTField * sizeof(_COTEntryType); \
28922894
pDXContext->cot.pa ## _COTField = (_COTEntryType *)pvCOT; \
28932895
pDXContext->cot.c ## _COTField = cEntries; \
28942896
break;
@@ -2926,7 +2928,7 @@ static int dxSetOrGrowCOTable(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext
29262928
*/
29272929
Assert(pvOldCOT && pvCOT);
29282930
if (pvOldCOT)
2929-
memcpy(pvCOT, pvOldCOT, validSizeInBytes);
2931+
memcpy(pvCOT, pvOldCOT, RT_MIN(validSizeInBytes, cbOldCOT));
29302932
}
29312933
else
29322934
{

0 commit comments

Comments
 (0)