summaryrefslogtreecommitdiff
path: root/src/VBox/Runtime/common/misc/sg.cpp
diff options
context:
space:
mode:
authorFelix Geyer <debfx-pkg@fobos.de>2011-07-29 17:55:18 +0200
committerFelix Geyer <debfx-pkg@fobos.de>2011-07-29 17:55:18 +0200
commitcba113ca2826bc4814be2f69a7704c865a37d4ea (patch)
tree511123b10dd1e58e56958520534f5c50e6f570fc /src/VBox/Runtime/common/misc/sg.cpp
parent6a16f6900dd884e07125b51c9625f6be0a1f9b70 (diff)
downloadvirtualbox-cba113ca2826bc4814be2f69a7704c865a37d4ea.tar.gz
Imported Upstream version 4.1.0-dfsgupstream/4.1.0-dfsg
Diffstat (limited to 'src/VBox/Runtime/common/misc/sg.cpp')
-rw-r--r--src/VBox/Runtime/common/misc/sg.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/VBox/Runtime/common/misc/sg.cpp b/src/VBox/Runtime/common/misc/sg.cpp
index 4d3192d86..08ef8b632 100644
--- a/src/VBox/Runtime/common/misc/sg.cpp
+++ b/src/VBox/Runtime/common/misc/sg.cpp
@@ -1,4 +1,4 @@
-/* $Id: sg.cpp $ */
+/* $Id: sg.cpp 36312 2011-03-18 12:59:15Z vboxsync $ */
/** @file
* IPRT - S/G buffer handling.
*/
@@ -38,6 +38,13 @@ static void *sgBufGet(PRTSGBUF pSgBuf, size_t *pcbData)
size_t cbData = RT_MIN(*pcbData, pSgBuf->cbSegLeft);
void *pvBuf = pSgBuf->pvSegCur;
+ AssertReleaseMsg( pSgBuf->cbSegLeft <= 5 * _1M
+ && (uintptr_t)pSgBuf->pvSegCur >= (uintptr_t)pSgBuf->paSegs[pSgBuf->idxSeg].pvSeg
+ && (uintptr_t)pSgBuf->pvSegCur + pSgBuf->cbSegLeft <= (uintptr_t)pSgBuf->paSegs[pSgBuf->idxSeg].pvSeg + pSgBuf->paSegs[pSgBuf->idxSeg].cbSeg,
+ ("pSgBuf->idxSeg=%d pSgBuf->cSegs=%d pSgBuf->pvSegCur=%p pSgBuf->cbSegLeft=%zd pSgBuf->paSegs[%d].pvSeg=%p pSgBuf->paSegs[%d].cbSeg=%zd\n",
+ pSgBuf->idxSeg, pSgBuf->cSegs, pSgBuf->pvSegCur, pSgBuf->cbSegLeft,
+ pSgBuf->idxSeg, pSgBuf->paSegs[pSgBuf->idxSeg].pvSeg, pSgBuf->idxSeg, pSgBuf->paSegs[pSgBuf->idxSeg].cbSeg));
+
pSgBuf->cbSegLeft -= cbData;
/* Advance to the next segment if required. */