Sha256: 4c58174eca883df7ddbbcf870b4d86d9f62ae5c76be4fa7529649f24a1a756f6

Contents?: true

Size: 887 Bytes

Versions: 9

Compression:

Stored size: 887 Bytes

Contents

use std::borrow::Cow;
use wasm_encoder::*;

#[test]
fn big_type_indices() {
    const N: u32 = 100_000;
    let mut module = Module::new();
    let mut types = TypeSection::new();
    for _ in 0..N {
        types.ty().function([], []);
    }
    module.section(&types);
    let mut funcs = FunctionSection::new();
    funcs.function(N - 1);
    module.section(&funcs);

    let mut elems = ElementSection::new();
    elems.declared(Elements::Functions(Cow::Borrowed(&[0])));
    module.section(&elems);

    let mut code = CodeSection::new();
    let mut body = Function::new([]);
    body.instruction(&Instruction::RefFunc(0));
    body.instruction(&Instruction::Drop);
    body.instruction(&Instruction::End);
    code.function(&body);
    module.section(&code);

    let wasm = module.finish();

    wasmparser::Validator::default()
        .validate_all(&wasm)
        .unwrap();
}

Version data entries

9 entries across 5 versions & 1 rubygems

Version Path
wasmtime-30.0.2 ./ext/cargo-vendor/wasmparser-0.224.1/tests/big-module.rs
wasmtime-29.0.0 ./ext/cargo-vendor/wasmparser-0.224.0/tests/big-module.rs
wasmtime-29.0.0 ./ext/cargo-vendor/wasmparser-0.221.2/tests/big-module.rs
wasmtime-28.0.0 ./ext/cargo-vendor/wasmparser-0.221.2/tests/big-module.rs
wasmtime-28.0.0 ./ext/cargo-vendor/wasmparser-0.223.0/tests/big-module.rs
wasmtime-27.0.0 ./ext/cargo-vendor/wasmparser-0.219.1/tests/big-module.rs
wasmtime-27.0.0 ./ext/cargo-vendor/wasmparser-0.220.0/tests/big-module.rs
wasmtime-26.0.0 ./ext/cargo-vendor/wasmparser-0.219.1/tests/big-module.rs
wasmtime-26.0.0 ./ext/cargo-vendor/wasmparser-0.218.0/tests/big-module.rs