# HG changeset patch # User Kim Alvefur # Date 1385651560 -3600 # Node ID 49e3c49eb0d8f33e94e2bf37e5421deacac5f499 # Parent f44c1dabd4e9eaa03d07d85fc0476b472a378df3 util.pposix: Verify that file handle is open diff -r f44c1dabd4e9 -r 49e3c49eb0d8 util-src/pposix.c --- a/util-src/pposix.c Fri Nov 22 15:27:21 2013 +0100 +++ b/util-src/pposix.c Thu Nov 28 16:12:40 2013 +0100 @@ -666,6 +666,8 @@ { off_t offset, len; FILE *f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE); + if (f == NULL) + luaL_error(L, "attempt to use a closed file"); offset = luaL_checkinteger(L, 2); len = luaL_checkinteger(L, 3);