lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Another minor issue: LoadConstants() in the boolean case does not
validate that the byte read represents a boolean.  Bytes greater than
1 should probably generate errors (or else coerce to 1).  As it
stands, loadstring() can be abused to create a boolean that is neither
true nor false.

> maybe = loadstring(string.dump(function() return ({[true]=true})[true] end):gsub('\1\1','\1\2'))()
> = type(maybe)
boolean
> = maybe==true, maybe==false
false   false

Greg F