Skip to content

.wasm file contains personal information when decoded into wat #4128

Closed
@cinqs

Description

@cinqs

Summary

I used wasm-bindgen (0.2.93) to convert my rust lib into wasm.
When installed with nodejs npm, and seen from the browser end, my personal information shown in the wat format

Additional Details

my rust code example:

#[wasm_bindgen]
pub fn bilateral_filter(
    img_data: &[u8],
    width: u32,
    height: u32,
    spatial_sigma: f32,
    range_sigma: f32,
    window_size: u32,
) -> Vec<u8>

decoded wat file pic:

(data (i32.const 1048580) "\04\00\00\00\04\00\00\00\02\00\00\00/Users/songci/.cargo/registry/src/index.crates.io-6f17d22bba15001f/image-0.25.2/src/buffer.rsImage index  out of bounds m\00\10\00\0c\00\00\00y\00\10\00\0f\00\00\00Buffer length in `ImageBuffer::new` overflows usize\00\10\00\10\00]\00\00\00\fa\04\00\00\0e\00\00\00\10\00\10\00]\00\00\00\9c\04\00\00\0f\00\00\00Could not convert raw image data.src/disperse.rs\0d\01\10\00\0f\00\00\00\10\00\00\00\0a\00\00\00\0d\01\10\00\0f\00\00\00\16\00\00\00\1a\00\00\00\0d\01\10\00\0f\00\00\00\19\00\00\00%\00\00\00\0d\01\10\00\0f\00\00\008\00\00\00\18\00\00\00\0d\01\10\00\0f\00\00\00K\00\00\00\0a\00\00\00\0d\01\10\00\0f\00\00\00O\00\00\00\1d\00\00\00\0d\01\10\00\0f\00\00\00S\00\00\00\22\00\00\00\0d\01\10\00\0f\00\00\00V\00\00\00\19\00\00\00\0d\01\10\00\0f\00\00\00W\00\00\00\19\00\00\00\0d\01\10\00\0f\00\00\00Z\00\00\00\14\00\00\00src/revert_pixels.rs\bc\01\10\00\14\00\00\00\0e\00\00\00\0a\00\00\00\bc\01\10\00\14\00\00\00\18\00\00\00\10\00\00\00Image index  out of bounds \00\f0\01\10\00\0c\00\00\00\fc\01\10\00\0f\00\00\00/Users/songci/.cargo/registry/src/index.crates.io-6f17d22bba15001f/image-0.25.2/src/imageops/sample.rs\00\00\1c\02\10\00f\00\00\00\13\02\00\00\11\00\00\00\1c\02\10\00f\00\00\00&\01\00\00C\00\00\00\1c\02\10\00f\00\00\00'\01\00\00C\00\00\00\1c\02\10\00f\00\00\00(\01\00\00C\00\00\00\1c\02\10\00f\00\00\00)\01\00\00C\00\00\00\1c\02\10\00f\00\00\00,\01\00\00\11\00\00\00\1c\02\10\00f\00\00\00\19\01\00\00\1f\00\00\00\1c\02\10\00f\00\00\00\e7\03\00\00\19\00\00\00Image index  out of bounds \00\04\03\10\00\0c\00\00\00\10\03\10\00\0f\00\00\00Could not convert raw image data.src/vignette.rsQ\03\10\00\0f\00\00\00\0e\00\00\00\0a\00\00\00Q\03\10\00\0f\00\00\00&\00\00\00\10\00\00\00src/bilateral_filter.rs\00\80\03\10\00\17\00\00\00\17\00\00\00\0a\00\00\00\80\03\10\00\17\00\00\00 \00\00\00$\00\00\00\80\03\10\00\17\00\00\00D\00\00\00\14\00\00\00\80\03\10\00\17\00\00\00-\00\00\00.\00\00\00assertion failed: min <= max/rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/cmp.rs\00\f4\03\10\00G\00\00\00\8c\03\00\00\09\00\00\00Image index  out of bounds \00L\04\10\00\0c\00\00\00X\04\10\00\0f\00\00\00src/unsharp_mask.rs\00x\04\10\00\13\00\00\00w\00\00\00!\00\00\00x\04\10\00\13\00\00\00x\00\00\00!\00\00\00x\04\10\00\13\00\00\00\aa\00\00\00\14\00\00\00x\04\10\00\13\00\00\00\9b\00\00\00'\00\00\00x\04\10\00\13\00\00\00\9c\00\00\00%\00\00\00x\04\10\00\13\00\00\00\be\00\00\00\13\00\00\00x\04\10\00\13\00\00\00\be\00\00\00\16\00\00\00Could not convert raw image data.\00\00\00x\04\10\00\13\00\00\00\22\00\00\00\0a\00\00\00x\04\10\00\13\00\00\00.\00\00\00#\00\00\00x\04\10\00\13\00\00\00b\00\00\00\0a\00\00\00\05\00\00\00\0c\00\00\00\04\00\00\00\06\00\00\00\07\00\00\00\08\00\00\00/rust/deps/dlmalloc-0.2.6/src/dlmalloc.rsassertion failed: psize >= size + min_overhead\00h\05\10\00)\00\00\00\a8\04\00\00\09\00\00\00assertion failed: psize <= size + max_overhead\00\00h\05\10\00)\00\00\00\ae\04\00\00\0d\00\00\00memory allocation of  bytes failed\00\00\10\06\10\00\15\00\00\00%\06\10\00\0d\00\00\00library/std/src/alloc.rsD\06\10\00\18\00\00\00b\01\00\00\09\00\00\00library/std/src/panicking.rsl\06\10\00\1c\00\00\00\8b\02\00\00\1e\00\00\00\05\00\00\00\0c\00\00\00\04\00\00\00\09\00\00\00\00\00\00\00\08\00\00\00\04\00\00\00\0a\00\00\00\00\00\00\00\08\00\00\00\04\00\00\00\0b\00\00\00\0c\00\00\00\0d\00\00\00\10\00\00\00\04\00\00\00\0e\00\00\00\0f")
  (data (i32.const 1050344) "\01\00\00\00\10\00\00\00capacity overflow\00\00\00\f0\06\10\00\11\00\00\00library/alloc/src/raw_vec.rs\0c\07\10\00\1c\00\00\00\19\00\00\00\05\00\00\00)\00\00\00\01\00\00\00\00\00\00\00called `Option::unwrap()` on a `None` value")
  (data (i32.const 1050488) "\01\00\00\00\12\00\00\00index out of bounds: the len is  but the index is \00\00\80\07\10\00 \00\00\00\a0\07\10\00\12\00\00\00\00\00\00\00\0c\00\00\00\04\00\00\00\13\00\00\00\14\00\00\00\15\00\00\00    , ,\0a((\0a,library/core/src/fmt/num.rs0x\00\00\00\e8\07\10\00\1b\00\00\00i\00\00\00\17\00\00\0000010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899range start index  out of range for slice of length \e0\08\10\00\12\00\00\00\f2\08\10\00\22\00\00\00range end index $\09\10\00\10\00\00\00\f2\08\10\00\22\00\00\00slice index starts at  but ends at \00D\09\10\00\16\00\00\00Z\09\10\00\0d\00\00\00\00\00\00?\00\00\00\bf\00\00\00\00\00\00\e0?\00\00\00\00\00\00\e0\bfclosure invoked recursively or after being dropped")

image

How is this happening? and How to avoid this?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions