add molly-guard

This commit is contained in:
tTh 2023-02-11 19:40:52 +01:00
parent 11d1cfd7de
commit f05bc14461

View File

@ -65,6 +65,12 @@ while (2==fscanf(input, "%d %d", &left, &right)) {
buffer[idx++] = left;
buffer[idx++] = right;
/* SANITY CONTROL */
if ( (abs(left) > 32767) || (abs(right) > 32767) ) {
fprintf(stderr, "OVERFLOW sample %9d values %7d %7d\n",
idx, left, right);
}
if (idx >= SMPL_COUNT) {
/* flush buffer to file */
sf_write_short(sndf, buffer, idx);