Don't overflow buffers if bsnes goes bonkers

The test state I got by corrupting savestate still crashes however.
This commit is contained in:
Ilari Liusvaara 2015-05-31 23:45:02 +03:00
parent 80867950f3
commit 1056f4b4b2

View file

@ -762,6 +762,8 @@ namespace
{
uint16_t _l = l_sample;
uint16_t _r = r_sample;
//Don't overflow buffers if bsnes goes bonkers.
if(soundbuf_fill >= sizeof(soundbuf) / sizeof(soundbuf[0])) return;
soundbuf[soundbuf_fill++] = l_sample;
soundbuf[soundbuf_fill++] = r_sample;
//The SMP emits a sample every 768 ticks of its clock. Use this in order to keep track of