tarantool / tarantool/tarantool
string.gsub() doesn't accept a pattern with zero byte in a middle
Open
Nobody has claimed this yet.
feature
- Dominant language
- Lua
- Stars
- 3.7k
- Forks
- 419
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 88
Description
tarantool> string.gsub('\x00abc', '[%z\x01-\xff]', 'x')
---
- xxxx
- 4
...
-- Expected "xxxx".
tarantool> string.gsub('\x00abc', '[\x00-\xff]', 'x')
---
- error: malformed pattern (missing ']')
...
-- Expected "axxxd".
tarantool> string.gsub('ab\x00cd', 'b\x00c', 'xxx')
---
- "axxx\0cd"
- 1
...
Other functions that accept a pattern look affected by the problem too, at least string.find() is affected.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the listed string.gsub() and string.find() examples in Tarantool, then trace the string pattern handling used by these entry points. Done means patterns containing zero bytes work without malformed-pattern errors and the shown replacement results match the expected outputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100