This repository was archived by the owner on Jun 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Remove use of unsafe transmute in read_f32 and read_f64 #14
Labels
Comments
Fixed by 7e8c792 |
Robbepop
pushed a commit
to Robbepop/wasmparser
that referenced
this issue
Jun 11, 2020
* Implement the wasm annotations proposal This commit implements the wasm annotations proposal in this crate, adding support for a number of features and items: * All annotation syntax, e.g. `(@foo ...)` is now skipped automatically. Parsers will have to explicitly opt-in to parsing annotation syntax, if supported. * Support for the `@name` annotation has been added. This annotation can annotate modules, functions, locals, and params. The name here takes precedent when creating the debug name section, and can support names other than wat identifiers. * Support for the `@custom` annotation has been added as well. This allows definining arbitrary custom sections in the text format. So long as your custom section doesn't refer to binary offsets and such you should be able to eventually round-trip from binary to text and back to binary! Parsers like `witx` and `wasm-interface-types` will need to change their behavior after this update. The previous method of "parsing annotations" will no longer work since annotations are skipped by default. Closes bytecodealliance#14 * Rustfmt * Fix tests and assertions * Add some review feedback * Parse annoations as normal tokens This requires having a known set of annotations, but follow-up commits will add that. For now just `name` and `custom` are "known annoations". * Implement dynamic registration of annotations * rustfmt * Consolidate registration of the `@name` annotation * Apply suggestions from code review Co-Authored-By: Nick Fitzgerald <[email protected]> * Clarify section names * Enable wabt tests * Use a newtype instead of a wonky encoding scheme Co-authored-by: Nick Fitzgerald <[email protected]>
Robbepop
pushed a commit
to Robbepop/wasmparser
that referenced
this issue
Jun 11, 2020
Updates the requirements on [wast](https://github.com/bytecodealliance/wat) to permit the latest version. - [Release notes](https://github.com/bytecodealliance/wat/releases) - [Commits](bytecodealliance/wat@wast-9.0.0...wast-10.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Robbepop
pushed a commit
to Robbepop/wasmparser
that referenced
this issue
Jun 11, 2020
This adds the two new opcodes added by the tail-call proposal, `return_call` and `return_call_indirect`. The main complication here is the validation.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
wasmparser currently uses an unsafe transmute to convert a floating-point literal from raw bytes to an
f32
orf64
. 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
orf64
format.The text was updated successfully, but these errors were encountered: