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

Audit unicode-normalization #52

Open
evanjs opened this issue Nov 3, 2019 · 2 comments
Open

Audit unicode-normalization #52

evanjs opened this issue Nov 3, 2019 · 2 comments

Comments

@evanjs
Copy link

evanjs commented Nov 3, 2019

unicode-normalization: GitHub, crates.io
Another widely-used crate.

Discovered some unsafe expressions when checking url (#51).

Once again, no clue if any of these are safe.

Metric output format: x/y
    x = unsafe code used by the build
    y = total unsafe code found in the crate

Symbols: 
    :) = No `unsafe` usage found, declares #![forbid(unsafe_code)]
    ?  = No `unsafe` usage found, missing #![forbid(unsafe_code)]
    !  = `unsafe` usage found

Functions  Expressions  Impls  Traits  Methods  Dependency

0/0        20/20        0/0    0/0     0/0      !  unicode-normalization 0.1.8
2/2        322/322      4/4    1/1     13/13    !  └── smallvec 0.6.12c

Example unsafe usage in decompose_hangul.

@CuriouslyCurious
Copy link

Shnatsel's pull request to replace smallvec with tinyvec was recently accepted, so that dependency is no longer a problem.

The decompose_hangul unsafeness can be removed by simply replacing the from_u32_unchecked function call with from_u32, but that may have some unforeseen performance or behavioural consequences. It will pass the tests in the project however.

@Shnatsel
Copy link
Member

I can't see a way to avoid unsafe character creation there without a performance hit, but at least we could add debug assertions there and then plug this into a fuzzer to see if they actually hold.

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

No branches or pull requests

3 participants