Skip to content

Fix NaN conversion in cJSON_SetNumberHelper - #1107

Open
Yash-Petkar wants to merge 1 commit into
DaveGamble:masterfrom
Yash-Petkar:fix-set-number-helper-nan
Open

Yash-Petkar wants to merge 1 commit into
DaveGamble:masterfrom
Yash-Petkar:fix-set-number-helper-nan

Conversation

@Yash-Petkar

Copy link
Copy Markdown

Summary

  • Handle NaN before converting the number to an integer in cJSON_SetNumberHelper().
  • Set valueint to 0 for NaN while preserving the original NaN in valuedouble.
  • Add a regression test covering both values.

This preserves the existing integer-boundary and infinity handling.

Testing

  • CMake configuration and build completed successfully with MSVC.
  • CTest: all 19 tests passed.
  • git diff --check passed.

Related issue

Addresses the NaN-to-integer conversion issue reported in #1100. Related: #805 and #1000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants