From 7e86867b27d1e55640a92b4ca8d50e79aa3bb1e4 Mon Sep 17 00:00:00 2001 From: Ben Wiley Date: Tue, 19 Oct 2021 00:06:26 -0400 Subject: [PATCH] SyroComp_CompBlock: Prevent stack buffer overflow --- syro/korg_syro_comp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syro/korg_syro_comp.c b/syro/korg_syro_comp.c index bd97d3c..117fcea 100644 --- a/syro/korg_syro_comp.c +++ b/syro/korg_syro_comp.c @@ -394,7 +394,7 @@ static int SyroComp_CompBlock(uint8_t *map_buffer, uint8_t *dest, ReadSample *pr /*----- wrtie bit-base ------*/ j = 0; for (i=0; i<16; i++) { - if (pBitBase[j]==i) { + if (j < 4 && pBitBase[j]==i) { BitHead[i] = j++; SyroComp_WriteBit(&wp, (uint32_t)(i-1), 4); } else {