Skip to content
This repository was archived by the owner on Jun 16, 2020. It is now read-only.
This repository was archived by the owner on Jun 16, 2020. It is now read-only.

Remove use of unsafe transmute in read_f32 and read_f64 #14

Closed
@sunfishcode

Description

@sunfishcode

wasmparser currently uses an unsafe transmute to convert a floating-point literal from raw bytes to an f32 or f64. In practice this is fairly safe, however it's desirable to avoid unsafe code in general.

It's tempting to convert these to the new to_bits/from_bits APIs in Rust once they become stable, however those APIs have the subtle behavior of quieting signaling NaNs, making them unusable for wasm decoding.

Cretonne solves a similar problem by representing floating-point literals as integers holding the bit patterns. I think that would work well for wasmparser too, since it isn't doing any of the actual floating-point arithmetic itself, so it doesn't need the values in f32 or f64 format.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions