这是indexloc提供的服务,不要输入任何密码
Skip to content

Tags: elsuizo/zed

Tags

nightly

Toggle nightly's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
task: use full task label to distinguish a terminal (zed-industries#1…

…0469)

Spotted by @SomeoneToIgnore, in zed-industries#10468 I've used a shortened task label,
which might lead to collisions.

Release Notes:

- N/A

v0.131.3-pre

Toggle v0.131.3-pre's commit message
zed 0.131.3

v0.131.2-pre

Toggle v0.131.2-pre's commit message
zed 0.131.2

v0.130.6

Toggle v0.130.6's commit message
zed 0.130.6

collab-staging

Toggle collab-staging's commit message
Booleans

collab-production

Toggle collab-production's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
WIP: remoting (zed-industries#10085)

Release Notes:

- Added private alpha support for remote development. Please reach out to hi@zed.dev if you'd like to be part of shaping this feature.

v0.131.1-pre

Toggle v0.131.1-pre's commit message
zed 0.131.1

v0.131.0-pre

Toggle v0.131.0-pre's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix panic when loading malformed Wasm files (cherry-pick zed-industri…

…es#10370) (zed-industries#10371)

Cherry-picked Fix panic when loading malformed Wasm files (zed-industries#10370)

This PR fixes a potential panic that could occur when loading malformed
Wasm files.

We now use the `parse_wasm_extension_version` function that was
previously used just to extract the Zed extension API version from the
Wasm bytes as a pre-validation step. By parsing the entirety of the Wasm
file here instead of returning as soon as we find the version, the
invalid Wasm bytes are now surfaced as an `Err` instead of a panic.

We were able to replicate the panic using the following test:

```rs
#[gpui::test]
async fn test_bad_wasm(cx: &mut TestAppContext) {
    init_test(cx);

    let wasm_host = cx.update(|cx| {
        WasmHost::new(
            FakeFs::new(cx.background_executor().clone()),
            FakeHttpClient::with_200_response(),
            FakeNodeRuntime::new(),
            Arc::new(LanguageRegistry::test(cx.background_executor().clone())),
            PathBuf::from("/the/work/dir".to_string()),
            cx,
        )
    });

    let mut wasm_bytes = std::fs::read("/Users/maxdeviant/Library/Application Support/Zed/extensions/installed/dart/extension.wasm").unwrap();

    // This is the error message we were seeing in the stack trace:
    // range end index 267037 out of range for slice of length 253952

    dbg!(&wasm_bytes.len());

    // Truncate the bytes to the same point:
    wasm_bytes.truncate(253952);

    std::fs::write("/tmp/bad-extension.wasm", wasm_bytes.clone()).unwrap();

    let manifest = Arc::new(ExtensionManifest {
        id: "the-extension".into(),
        name: "The Extension".into(),
        version: "0.0.1".into(),
        schema_version: SchemaVersion(1),
        description: Default::default(),
        repository: Default::default(),
        authors: Default::default(),
        lib: LibManifestEntry {
            kind: None,
            version: None,
        },
        themes: Default::default(),
        languages: Default::default(),
        grammars: Default::default(),
        language_servers: Default::default(),
    });

    // 💥
    let result = wasm_host
        .load_extension(wasm_bytes, manifest, cx.executor())
        .await;
    dbg!(result.map(|_| ()));
```



Release Notes:

- Fixed a crash that could occur when loading malformed Wasm extensions
([zed-industries#10352](zed-industries#10352)).

---------

Co-authored-by: Max <max@zed.dev>

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Max <max@zed.dev>

v0.130.5

Toggle v0.130.5's commit message
zed 0.130.5

v0.130.4

Toggle v0.130.4's commit message
v0.130.x stable