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

OOB memory error in wasm32 #13918

Open
straight-shoota opened this issue Oct 30, 2023 · 2 comments
Open

OOB memory error in wasm32 #13918

straight-shoota opened this issue Oct 30, 2023 · 2 comments
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. platform:wasm topic:stdlib:runtime

Comments

@straight-shoota
Copy link
Member

In #13844 the wasm32 spec fails.

Error: failed to run main module `wasm32_std_spec.wasm`

Caused by:
    0: failed to invoke command default
    1: error while executing at wasm backtrace:
           0: 0x1fed53 - <unknown>!dlmalloc
           1: 0x200db0 - <unknown>!realloc
           2: 0xa3818 - realloc
                           at /home/johannes/src/crystal-lang/crystal/src/gc/none.cr:21:5
           3: 0xa3804 - __crystal_realloc64
                           at /home/johannes/src/crystal-lang/crystal/src/gc.cr:46:3
           4: 0x15642e - realloc
                           at /home/johannes/src/crystal-lang/crystal/src/pointer.cr:359:18
           5: 0x155a73 - realloc_entries
                           at /home/johannes/src/crystal-lang/crystal/src/hash.cr:910:16
           6: 0x154950 - resize
                           at /home/johannes/src/crystal-lang/crystal/src/hash.cr:589:7
           7: 0x153c3b - upsert
                           at /home/johannes/src/crystal-lang/crystal/src/hash.cr:378:11
           8: 0x15330e - []=
                           at /home/johannes/src/crystal-lang/crystal/src/hash.cr:1050:5
           9: 0x71ece - ~HTML::SINGLE_CHAR_ENTITIES:init
                           at /home/johannes/src/crystal-lang/crystal/src/html/entities.cr:3:26
          10: 0x1da3 - __crystal_main
                           at /home/johannes/src/crystal-lang/crystal/src/html/entities.cr:3:3
          11: 0x1fe43c - main_user_code
                           at /home/johannes/src/crystal-lang/crystal/src/crystal/main.cr:129:5
          12: 0xbbf71 - main
                           at /home/johannes/src/crystal-lang/crystal/src/crystal/main.cr:115:7
          13: 0xbbf37 - main
                           at /home/johannes/src/crystal-lang/crystal/src/crystal/main.cr:141:3
          14: 0xbc029 - __main_argc_argv
                           at /home/johannes/src/crystal-lang/crystal/src/crystal/system/wasi/main.cr:32:3
          15: 0x201946 - <unknown>!__main_void
          16: 0xbbfd8 - _start
                           at /home/johannes/src/crystal-lang/crystal/src/crystal/system/wasi/main.cr:25:12
    2: memory fault at wasm address 0x73657268 in linear memory of size 0x70000
    3: wasm trap: out of bounds memory access

Considering that the code works flawlessly in other backends, there seems to be an error in the wasm32 integration.

Originally posted by @straight-shoota in #13844 (comment)

@straight-shoota
Copy link
Member Author

A branch with this error reproduction and some bug reconnaissance is available here: https://github.com/straight-shoota/crystal/tree/test/html-unescape-wasm32

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:runtime platform:wasm labels Oct 30, 2023
@straight-shoota
Copy link
Member Author

A similar issue was noticed on #14067 (comment)

https://github.com/crystal-lang/crystal/actions/runs/7128256420/job/19410152386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. platform:wasm topic:stdlib:runtime
Projects
None yet
Development

No branches or pull requests

1 participant