Fix issue where strings intermittently get corrupted by the Image module.
Imported from https://youtrack.roxen.com/issue/PIKE-27
Reported by @grubba
If a dynamically allocated string (eg "Random.Deterministic") that had an active substring (eg "Deterministic") later got replaced with a statically allocated string, the substring would point to freed memory.
Fixes intermittent failures to resolve "Random.Deterministic" in from Image.Image()->test(), as well as the fatal "Shared string is not zero terminated properly." from eg _verify_internals().