Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBOR Writer: Use canonical NaN representation for NaN values #92934

Merged
merged 5 commits into from
Oct 6, 2023

Commits on Oct 6, 2023

  1. Use canonical NaN representation for NaN values

    RFC 7049 (CBOR) specifies "If NaN is an allowed value, it must always be represented as 0xf97e00". The only exception is when the user explicitly requests precision (FP size) is preserved.
    
    The problem occurred for x86, C# defines NaN as 0.0/0.0 which yields -NaN on x86 FP units, which gets encoded as 0xf9fe00.
    
    Fixes issue dotnet#92080
    tomeksowi committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    5b6f257 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8959a2a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e555cb9 View commit details
    Browse the repository at this point in the history
  4. Add CborReader tests to verify the previously emitted negative NaN bi…

    …t patterns are still readable as NaN.
    tomeksowi committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    a77502c View commit details
    Browse the repository at this point in the history
  5. Use only half-float canonical CBOR representation for NaNs

    NaNs only get written as 4 or 8 bytes only in CTAP2 mode, which requires to preserve all bits anyway.
    
    + review fixes
    tomeksowi committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    69b97e9 View commit details
    Browse the repository at this point in the history