| 1 | diff -Naur a/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp b/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
|
|---|
| 2 | --- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp 2022-11-17 22:12:55.000000000 +0300
|
|---|
| 3 | +++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp 2022-12-05 16:06:25.417632425 +0300
|
|---|
| 4 | @@ -1093,6 +1093,8 @@
|
|---|
| 5 |
|
|---|
| 6 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[idDstScreen];
|
|---|
| 7 |
|
|---|
| 8 | + uint32_t const cbScreenPixel = RT_ALIGN(pScreen->cBpp, 8) / 8;
|
|---|
| 9 | +
|
|---|
| 10 | if ( srcRect.right <= srcRect.left
|
|---|
| 11 | || srcRect.bottom <= srcRect.top)
|
|---|
| 12 | return VINF_SUCCESS; /* Empty src rect. */
|
|---|
| 13 | @@ -1186,6 +1188,8 @@
|
|---|
| 14 | + ((box.x + pSurface->cxBlock - 1) / pSurface->cxBlock) * pSurface->cxBlock * pSurface->cbBlock
|
|---|
| 15 | + ((box.y + pSurface->cyBlock - 1) / pSurface->cyBlock) * pSurface->cyBlock * srcMap.cbRowPitch;
|
|---|
| 16 |
|
|---|
| 17 | + uint32_t const offDstBox = (dstBox.x + box.x) * cbScreenPixel + (dstBox.y + box.y) * pScreen->cbPitch;
|
|---|
| 18 | +
|
|---|
| 19 | /* The 'box' is actually in the destination coordinates relative to the top-left corner of destRect.
|
|---|
| 20 | * Therefore it is relative to the top-left corner of srcRect as well.
|
|---|
| 21 | */
|
|---|
| 22 | @@ -1198,11 +1202,11 @@
|
|---|
| 23 | {
|
|---|
| 24 | AssertContinue(srcDims.cyBlocks > 0);
|
|---|
| 25 |
|
|---|
| 26 | - ASSERT_GUEST_BREAK( srcDims.offBox <= cbDst
|
|---|
| 27 | - && pScreen->cbPitch * (srcDims.cyBlocks - 1) + srcDims.cbRow <= cbDst - srcDims.offBox);
|
|---|
| 28 | + ASSERT_GUEST_BREAK( offDstBox <= cbDst
|
|---|
| 29 | + && pScreen->cbPitch * (srcDims.cyBlocks - 1) + srcDims.cbRow <= cbDst - offDstBox);
|
|---|
| 30 | RT_UNTRUSTED_VALIDATED_FENCE();
|
|---|
| 31 |
|
|---|
| 32 | - uint8_t *pu8DstBox = pu8Dst + srcDims.offBox;
|
|---|
| 33 | + uint8_t *pu8DstBox = pu8Dst + offDstBox;
|
|---|
| 34 |
|
|---|
| 35 | if ( pSurface->format == SVGA3D_R8G8B8A8_UNORM
|
|---|
| 36 | || pSurface->format == SVGA3D_R8G8B8A8_UNORM_SRGB)
|
|---|