-
Notifications
You must be signed in to change notification settings - Fork 995
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
runtime: Add null pointer exception for read #2780
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a268d4d
runtime: Throw null pointer exception on read
evaporei e1578df
runtime: Add test for null pointer exception on operator overloading
evaporei 17242c8
runtime: Update README.md AS version
evaporei d03ddb0
runtime: Add arity to invoke_export test function name
evaporei 821e337
runtime: Make size_of_rt_size a constant
evaporei d7a17e7
runtime: Validate pointer access instead of using coersion on tests
evaporei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we say something more helpful here (like what that means in terms of pointers)? Is this always an internal error? And it seems that
size_of_rt_size
could beconst
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct, the size of
rt_size
can be changed to aconst
, I'll change that.This
Subtract overflow
shouldn't happen, it's related to the way every type is layed out in memory.All class instances in AssemblyScript have a header of 20 bytes, of which the last 4 hold the size of the following data.
AS header memory layout docs: https://www.assemblyscript.org/memory.html#common-header-layout.
Our
AscPtr
structure holds a number which is the address in WebAssembly memory of where that class instance starts their data (right after the header).So this part of the code tries to do a pointer arithmetic to get the size of the structure, so it can read it fully in a correct fashion.
Maybe what I can write instead of this message is that it failed to find the size of the following structure.
The part about being an internal/external error, in this case it actually can appear in the explorer logs, like Adam found them. It will either happen when we messed up (me in this case, cause I did this code haha) the AS memory layout, or AS is writing data to memory that doesn't conform to the especification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the constant but I'll let these (there are more) "Subtract overflow" to fix later. I want to discuss more with @leoyvens on this. Thanks for your input!