summaryrefslogtreecommitdiff
path: root/src/VBox/Runtime/common/misc/sg.cpp
diff options
context:
space:
mode:
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. */