summaryrefslogtreecommitdiff
path: root/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2018-03-31 13:47:29 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2018-03-31 13:47:29 +0000
commit836480ba2a419e724a2884f36f4740da99083ec3 (patch)
tree0c5b05af321784a0435869de85d5c1aead65e9ee /src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
parent2c5ceeec04e9a0c0b73c7bc3c7790498ec83aa74 (diff)
downloadVirtualBox-svn-836480ba2a419e724a2884f36f4740da99083ec3.tar.gz
DevVGA_VDMA.cpp: Added missing+buggy bits from ?bugref:9054.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@71588 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Devices/Graphics/DevVGA_VDMA.cpp')
-rw-r--r--src/VBox/Devices/Graphics/DevVGA_VDMA.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp b/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
index ddef389219e..175500d7cda 100644
--- a/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
@@ -2558,7 +2558,7 @@ static int vboxVDMACmdExecBltPerform(PVBOXVDMAHOST pVdma, const VBOXVIDEOOFFSET
for (uint32_t i = 0; ; ++i)
{
if ( cbDstLine <= cbVRamSize
- && (uintptr_t)pbSrcStart - (uintptr_t)pbRam <= cbVRamSize - cbDstLine
+ && (uintptr_t)pbDstStart - (uintptr_t)pbRam <= cbVRamSize - cbDstLine
&& (uintptr_t)pbSrcStart - (uintptr_t)pbRam <= cbVRamSize - cbDstLine)
memcpy(pbDstStart, pbSrcStart, cbDstLine);
else
@@ -2714,6 +2714,25 @@ static int vboxVDMACmdExecBpbTransfer(PVBOXVDMAHOST pVdma, const VBOXVDMACMD_DMA
*/
uint32_t cbTransfered = 0;
int rc = VINF_SUCCESS;
+
+ if (pTransfer->fFlags & VBOXVDMACMD_DMA_BPB_TRANSFER_F_SRC_VRAMOFFSET)
+ {
+ if (RT_LIKELY( pTransfer->cbTransferSize <= pVGAState->vram_size
+ && pTransfer->Src.offVramBuf <= pVGAState->vram_size - pTransfer->cbTransferSize))
+ { /* likely */ }
+ else
+ return VERR_INVALID_PARAMETER;
+ }
+
+ if (pTransfer->fFlags & VBOXVDMACMD_DMA_BPB_TRANSFER_F_DST_VRAMOFFSET)
+ {
+ if (RT_LIKELY( pTransfer->cbTransferSize <= pVGAState->vram_size
+ && pTransfer->Dst.offVramBuf <= pVGAState->vram_size - pTransfer->cbTransferSize))
+ { /* likely */ }
+ else
+ return VERR_INVALID_PARAMETER;
+ }
+
do
{
uint32_t cbSubTransfer = cbTransfer;