corert
corert copied to clipboard
Add array bounds checks
Array accesses should throw an IndexOutOfRangeException (or trap) if the index is less than 0 or >= the array's length. #6383 established a similar pattern for null checks (calling a separate inlinable function that does the check to avoid having to juggle a bunch of basic blocks). The methods that need checks are:
- ImportLoadElement
- ImportStoreElement
- ImportAddressOfElement
Hi, I never contributed to an open source project before, but I would really like to contribute to the CoreRT project. This seems like an issue that I can pick up. Can I give it a try?
You are welcomed to. cc @yowl
A good place to look first could be
https://github.com/dotnet/corert/blob/325f31dce46e893506899c913c39be6c4b219750/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs#L4939-L4946
The NRE check is there.
The coding style link seems broken, but I guess most of it is just common sense.
Should be here now https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/coding-style.md
Apologies if I'm being too pedantic, but llvm is not listed as a prerequisite for running a build on Ubuntu. It felt a bit useless to add an issue for that.
Did step 4 at https://github.com/dotnet/corert/blob/master/Documentation/how-to-build-WebAssembly.md not work for you?
Oh, no I meant the Prerequisites documentation. llvm is missing from the necessary apt packages in the Ubuntu section, however, I believe it is necessary to run the build.sh script.
Hi yowl, I ran into some issues while running the WebAssembly build following the documentation.
- The link for the Emscripten installation in the documentation redirects to a new page.
emcmakecan not be found when usingsudo, withoutsudo, running the build script results in a PermissionError, so you would need to change the ownership of theemscriptenfolder in the Emscripten-SDK.libLLVMdep.depprojis no longer located incorert/tests/src/Simple/HelloWasm, I found a file with the same name incorert/src/ILCompiler.WebAssembly/srcthat worked for me.
My OS is Ubuntu 20.04, but the libLLVM.so for Ubuntu 18.04 works fine so far. There is no nuget packages yet for 20.04.
Hi @yowl, I wanted to give a little update on running ILCompiler.WebAssembly on Ubuntu 20.04, I ran into libLLVM-9.so by accident while going through /usr/lib/, I think it comes with the default installation of the llvm apt package, however, it is versioned. Perhaps we could get around the tedious dotnet-restore procedure in step 4 of the wasm build documentation by setting an environment variable in the same we you do that for clang in the prerequisites documentation. Again, just trying to be of help. Apologies if I'm being very pedantic about the documentation.
I'm not sure I understand what fails, the so file is used at runtime only so I would have thought that as long as there is the sym link in /usr/lib the normal linux library resolving should find it. We could add a step to the documentation, /sbin/ldconfig -v -N | grep libLLVM and check for a v9 ?
The other option that Jan mentioned is to try the CentOS version and see if we can get away with that being as its a fairly "vanilla" linux distro. If that works we can create a PR in LLVMSharp to create a nuget based on that binary, but with the generic RID,linux-x64