I would like to emphasize this point. Often, code that has problems
with this new implementation in 5.4.3 was already bugged for older Lua
versions, but the bug only happened when the buffer got sufficiently
large, and so the bug could go unnoticed.
That was probably the case for me as well. Now I have converted my code to a Lua 5.4.3-style obtained from lstrlib.c, and it seems to work fine with Lua 5.1 to 5.4. Fingers crossed :-).