diff --git a/src/libespeak-ng/klatt.c b/src/libespeak-ng/klatt.c index 99a82526..15341912 100644 --- a/src/libespeak-ng/klatt.c +++ b/src/libespeak-ng/klatt.c @@ -421,7 +421,7 @@ static int parwave(klatt_frame_ptr frame) echo_head = 0; sample_count++; - if (out_ptr >= out_end) + if (out_ptr + 2 > out_end) return 1; } return 0; diff --git a/src/libespeak-ng/wavegen.c b/src/libespeak-ng/wavegen.c index c569e976..3bcda8b1 100644 --- a/src/libespeak-ng/wavegen.c +++ b/src/libespeak-ng/wavegen.c @@ -889,7 +889,7 @@ static int Wavegen() if (echo_head >= N_ECHO_BUF) echo_head = 0; - if (out_ptr >= out_end) + if (out_ptr + 2 > out_end) return 1; } } @@ -922,7 +922,7 @@ static int PlaySilence(int length, bool resume) if (echo_head >= N_ECHO_BUF) echo_head = 0; - if (out_ptr >= out_end) + if (out_ptr + 2 > out_end) return 1; } return 0; @@ -975,7 +975,7 @@ static int PlayWave(int length, bool resume, unsigned char *data, int scale, int if (echo_head >= N_ECHO_BUF) echo_head = 0; - if (out_ptr >= out_end) + if (out_ptr + 2 > out_end) return 1; } return 0;