$OpenBSD: patch-src_sndfile_cpp,v 1.1 2011/05/05 21:25:48 jasper Exp $

Fixed possible memory overread in CSoundFile::AdjustSampleLoop().
From upstream git: fda0caf6490bb76cba349ae3e198b0d11d35c7c0

--- src/sndfile.cpp.orig	Fri Mar 25 23:02:07 2011
+++ src/sndfile.cpp	Thu May  5 23:22:01 2011
@@ -1550,7 +1550,9 @@ void CSoundFile::AdjustSampleLoop(MODINSTRUMENT *pIns)
 //----------------------------------------------------
 {
 	if (!pIns->pSample) return;
+	if (pIns->nLength > MAX_SAMPLE_LENGTH) pIns->nLength = MAX_SAMPLE_LENGTH;
 	if (pIns->nLoopEnd > pIns->nLength) pIns->nLoopEnd = pIns->nLength;
+	if (pIns->nLoopStart > pIns->nLength+2) pIns->nLoopStart = pIns->nLength+2;
 	if (pIns->nLoopStart+2 >= pIns->nLoopEnd)
 	{
 		pIns->nLoopStart = pIns->nLoopEnd = 0;
