couchbase / couchbase/fleece

Infinities and NaNs get encoded as invalid JSON

Open
#42 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
338
Forks
35
Avg merge
13h 41m
Merged PRs (30d)
3

Description

A Fleece value can legitimately be a floating-point infinity or NaN, since it just stores a binary IEEE format float/double.

However, there's no JSON encoding of such a value. Currently Fleece just uses sprintf, which writes something like Inf or NaN ... resulting in invalid JSON.

Instead, the best behavior is probably to fail (throw an exception / return an error) when encoding such a value.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

No file or test is named in the issue. Locate the JSON encoder and its sprintf-based floating-point path, then inspect how encoding errors are reported; done means infinity and NaN no longer produce invalid JSON and instead trigger the chosen error behavior, with coverage for both values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.