mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-12 13:33:19 +00:00
Direct and indirect eval, Function and host evaluators parsed and compiled their source before taking any fuel or checking the heap, so a script with a small fuel limit could make the interpreter parse megabytes of source in a handful of instructions. Interp::prepare_source now takes one unit of fuel for each UTF-16 code unit and checks that the source text fits in the heap before the source is flattened, parsed or compiled. A host evaluator's string takes the fuel for a third of its bytes before it is encoded, and the rest after. Limits::fuel and the maxFuel row in docs/mcp.md say so.