shithub: sox

Download patch

ref: 4243565873b2284284af4c60c9c962e2960e0c28
parent: fbd851f5148e58f3f1884a502c397682ec53f14f
author: rrt <rrt>
date: Wed Jan 17 09:56:52 EST 2007

Fix an off-by-one error in reading the output from the Lua script.
Sadly, such a thing is in the nature of the beast: Lua arrays are
1-based.

--- a/src/luaeff.c
+++ b/src/luaeff.c
@@ -132,7 +132,8 @@
     st_fail("output buffer size %d too large for Lua", *osamp);
     return ST_EOF;
   }
-  for (i = 0; i < (int)*osamp; i++) {
+  /* Read output: Lua array is 1-based */
+  for (i = 1; i <= (int)*osamp; i++) {
     lua_rawgeti(lua->L, -1, i);
     obuf[i] = lua_tointeger(lua->L, -1);
     lua_pop(lua->L, 1);