Skip to content

fix(libkernel): preserve 64-bit metadata download sizes - #661

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
NumberGuan:codex/fix-metadata-download-size
Oct 5, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
NumberGuan:codex/fix-metadata-download-size

Conversation

@NumberGuan

Copy link
Copy Markdown
Contributor

What

parseParamJson converts downloadDataSize through double, which changes large integer values. For example, 9007199254740993 becomes 9007199254740992. Converting an out-of-range floating-point value to uint64_t also has undefined behavior in C++.

Keep the numeric token and parse unsigned integer literals directly with std::from_chars. Values through UINT64_MAX remain exact, and larger integers throw. Decimal and exponent forms retain their existing conversion behavior, with a range check before the cast.

Add a test linked against libkernel for omitted and zero sizes, normal sizes, integers above the exact range of double, both upper uint64 boundaries, decimal/exponent compatibility, overflow, negative values, and invalid JSON value types.

Tested

Windows, Release, WinLibs GCC 15.2.0 UCRT POSIX:

cmake --build build --target param_json_parser_tests guest_filesystem_tests --parallel 4
ctest --test-dir build -R '^(param_json_parser|guest_filesystem)$' --output-on-failure --no-tests=error

Both tests passed. The new regression test failed on the original code at 9007199254740993. No title or homebrew was run. Linux and the full suite were not run locally.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments added in code
  • Unimplemented paths throw; no silent stubs added
  • No investigation files or images added
  • No third-party code added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes, Codex

@NumberGuan
NumberGuan marked this pull request as ready for review October 5, 2026 12:14
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#710 core/libs/tests/ParamJsonParser.cpp core/libs/tests/ParamJsonParser.cpp

@oneandonlydean
oneandonlydean merged commit 78c17a1 into boykopovar:main Oct 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants