safer stl/module.nas & add stl/file.nas encapsulated from lib.nas/io

This commit is contained in:
ValKmjolnir
2022-03-06 15:17:39 +08:00
parent ca9b8581b4
commit debe32b187
7 changed files with 72 additions and 23 deletions
+2
View File
@@ -757,6 +757,8 @@ nasal_ref builtin_read(nasal_ref* local,nasal_gc& gc)
return builtin_err("read","not a correct filehandle");
if(buf.type!=vm_str)
return builtin_err("read","\"buf\" must be string");
if(buf.value.gcobj->unmut)
return builtin_err("read","\"buf\" is not a mutable string");
if(len.type!=vm_num)
return builtin_err("read","\"len\" must be number");
if(len.num()<=0 || len.num()>=(1<<30))