This is the translation of my blog posts. You can find them here (in Russian).
The following Lua program generates a Lua bytecode program called lua-sandbox-rce.luac
, which in turn spawns a shell from within Lua 5.1 sandbox. The remainder of this document attempts to explain how this program works by a whirlwind tour of relevent bits of the Lua 5.1 virtual machine.
function outer()
local magic -- In bytecode, the stack slot corresponding to this local is changed
local function middle()
local co, upval
local ub1 = {[0] = -- Convert uint8_t to char[1]
One of the most common projects I've seen for ComputerCraft is to write an operating system. People look at the limited command-line interface that CraftOS provides, and think, "I want this to work like my normal computer does!" Time and time again, a new post pops up on the ComputerCraft forums or Discord either announcing an OS, or asking for help with an OS, or releasing an OS. Usually, there are some very obvious flaws in these "OS"es, ranging from poor design choices, to overstating what they are and underdelivering. There are many common misunderstandings and undersights that newbie developers run into when writing an operating system, and these end up creating mediocre products at best.
The term "OS" is thrown around a lot, and in my opinion it's very overused. According to [Wikipedia]: "An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs." However, m
This is a list of Minecraft 1.7.10 mods that are not focused on adding new original content. Instead, they make the base game run better, or port over features from other versions of vanilla.
These lists try to comprehensively list all the available options. You will not want to use all of the listed mods at once.
Some of the listed mods require a Mixin bootstrap mod in order to work. See the Mixin mods section near the end of the document for information about that.
as
does a huge number of things. Probably too many. Here's a comprehensive list of everything it can do.
Note that as
conversions are transitive: If a as B as C
compiles, then so does a as C
, though it might not take the same "path" through intermediate conversions.
- int <-> int
zero_extend
: unsigned int -> bigger unsigned int. Pads the number with leading zeroes.sign_extend
: signed int -> bigger signed int. Pads the number with leading zeroes if positive, and leading ones if negative.truncate
: bigger int -> smaller int (regardless of signedness). Throws away the high bits of the numberreinterpret_sign
: int -> int of the same size and opposite signedness. Does nothing to the bits.
- int <-> float
cast_saturate_to_infinity
: Yields the float closest to the specified integer. Yields infinity if the integer is out of bounds.
cast_nan_to_zero_saturating_when_out_of_bounds
: Truncates the float and yields the corresponding integer.