(svn r22874) -Fix [FS#4747]: Check size of various buffers before allocation. (monoid)

This commit is contained in:
michi_cc
2011-09-02 20:16:41 +00:00
parent 4b6c2259ed
commit 7c325fcb78
5 changed files with 15 additions and 5 deletions

View File

@@ -63,7 +63,9 @@ const char *SoundDriver_Win32::Start(const char * const *parm)
wfex.nBlockAlign = (wfex.nChannels * wfex.wBitsPerSample) / 8;
wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;
/* Limit buffer size to prevent overflows. */
_bufsize = GetDriverParamInt(parm, "bufsize", (GB(GetVersion(), 0, 8) > 5) ? 8192 : 4096);
_bufsize = min(_bufsize, UINT16_MAX);
try {
if (NULL == (_event = CreateEvent(NULL, FALSE, FALSE, NULL))) throw "Failed to create event";