ref: 908054f1665a91078bd05f9cc6414d584dc6d393
parent: b85e12db623f6fe1c8681855df01fbd5cff78947
author: rrt <rrt>
date: Sat Sep 8 09:06:29 EDT 2007
Add some defensive checks to sox_flow_effects.
--- a/src/effects.c
+++ b/src/effects.c
@@ -289,7 +289,7 @@
e = sox_neffects - 1;
while (source_e < sox_neffects) {
-#define have_imin (sox_effects[e - 1][0].olen - sox_effects[e - 1][0].odone >= sox_effects[e][0].imin)
+#define have_imin (e > 0 && e < sox_neffects && sox_effects[e - 1][0].olen - sox_effects[e - 1][0].odone >= sox_effects[e][0].imin)
if (e == source_e && (draining || !have_imin)) {
if (drain_effect(e) == SOX_EOF) {
++source_e;
@@ -300,7 +300,7 @@
source_e = e;
draining = sox_true;
}
- if (sox_effects[e][0].olen > sox_effects[e][0].odone) /* False for output */
+ if (e < sox_neffects && sox_effects[e][0].olen > sox_effects[e][0].odone) /* False for output */
++e;
else if (e == source_e)
draining = sox_true;