From 3613bc0862d323332c5c5b9fc5d627a3cc2fbf69 Mon Sep 17 00:00:00 2001 From: Enyby Date: Sat, 12 Oct 2019 17:51:04 +0300 Subject: [PATCH] Add check for values passed to file:vsetbuf and file:seek. --- src/core/org/luaj/vm2/lib/IoLib.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/core/org/luaj/vm2/lib/IoLib.java b/src/core/org/luaj/vm2/lib/IoLib.java index 9b2cb25d..e386f4d8 100644 --- a/src/core/org/luaj/vm2/lib/IoLib.java +++ b/src/core/org/luaj/vm2/lib/IoLib.java @@ -427,6 +427,12 @@ public class IoLib extends TwoArgFunction { // file:setvbuf(mode,[size]) -> void public Varargs _file_setvbuf(LuaValue file, String mode, int size) { + if ("no".equals(mode)) { + } else if ("full".equals(mode)) { + } else if ("line".equals(mode)) { + } else { + argerror(1, "invalid option '" + mode + "', must be one of 'no', 'full' or 'line'"); + } checkfile(file).setvbuf(mode,size); return LuaValue.TRUE; } @@ -443,6 +449,12 @@ public class IoLib extends TwoArgFunction { // file:seek([whence][,offset]) -> pos | nil,error public Varargs _file_seek(LuaValue file, String whence, int offset) throws IOException { + if ("set".equals(whence)) { + } else if ("end".equals(whence)) { + } else if ("cur".equals(whence)) { + } else { + argerror(1, "invalid option '" + whence + "', must be one of 'set', 'cur' or 'end'"); + } return valueOf( checkfile(file).seek(whence,offset) ); }