mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-12 15:52:52 +00:00
Flattening a concatenated string copies its units into a new buffer. The string built-ins reserve that copy with flat_charged, but several other paths flattened without it, so a script could build copies the heap limit never saw: - the relational operators (`<`, `>`, `<=`, `>=`) on two strings, `==` between a string and a number, unary `+` and every other ToNumber of a string, and reading a character by index (`s[0]`) - a property name made from an object whose toString returns a long string, and a long string used as a property name, which now reserves its copy before it is made instead of after - direct `eval` of a concatenated source - `JSON.stringify` of a string value and its `space` argument - `Array.prototype.join`'s separator and each string element it writes Property names and eval source reserve the copy's heap bytes without taking fuel.