rust/library/std
Yuki Okushi 9ce0820eef
Rollup merge of #82804 - alexcrichton:fix-wasi, r=pnkfelix
std: Fix a bug on the wasm32-wasi target opening files

This commit fixes an issue pointed out in #82758 where LTO changed the
behavior of a program. It turns out that LTO was not at fault here, it
simply uncovered an existing bug. The bindings to
`__wasilibc_find_relpath` assumed that the relative portion of the path
returned was always contained within thee input `buf` we passed in. This
isn't actually the case, however, and sometimes the relative portion of
the path may reference a sub-portion of the input string itself.

The fix here is to use the relative path pointer coming out of
`__wasilibc_find_relpath` as the source of truth. The `buf` used for
local storage is discarded in this function and the relative path is
copied out unconditionally. We might be able to get away with some
`Cow`-like business or such to avoid the extra allocation, but for now
this is probably the easiest patch to fix the original issue.
2021-03-14 13:07:33 +09:00
..
benches
src Rollup merge of #82804 - alexcrichton:fix-wasi, r=pnkfelix 2021-03-14 13:07:33 +09:00
tests Fix SGX CI, take 3 2020-12-07 15:22:34 +01:00
build.rs Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
Cargo.toml Bump libc dependency of std to 0.2.88. 2021-03-05 20:54:14 +01:00