Configure integer overflow in json.decode()

Open Beginner friendly
#5,755 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
lua
Domain
documentation

Research direction

The payload names no file. Start from the existing reference page for the Tarantool json module, where json.cfg options are documented, and check whether decode_overflow is already described there. Add the option with its two values, clamp (default) and error, plus the per-call form json.decode(data, {decode_overflow = 'error'}) and a note that it applies at any nesting level. Done when the page covers both values and the per-call override, and the behaviour matches commit 9d9923b02f99e0ada3a5cd5f0d5eb2b2fe0abf13.

Written by the indexing model from the issue text.

Description

The decode_overflow option accepts two values:

  • clamp (default): values below INT64_MIN become INT64_MIN, and values
    above UINT64_MAX become UINT64_MAX.
  • error: raise an error with the location of the overflowing integer.

Use json.cfg({decode_overflow = 'error'}) for an instance, or
json.decode(data, {decode_overflow = 'error'}) for a single call without
changing the instance settings. The option applies at any nesting level.
In-range integers, floating-point input, and encoding are unchanged.
Requested by @Yukigaru in https://github.com/tarantool/tarantool/commit/9d9923b02f99e0ada3a5cd5f0d5eb2b2fe0abf13.

Dominant language
CSS
Stars
16
Forks
49
Avg merge
5d 18h
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tarantool/doc

All issues in tarantool/doc

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.