Initial commit for negative array size check #871
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.
Hi @konsoletyper
Here is initial implementation for negative array size check. I investigated code and assumed the place where instructions should be modified. I can see that in BoundCheckInsertion class has code that intercepts ConstructArrayInstruction in checks and then if check is correct then restores flow of the program, else throws corresponding exceptions. Still, I faced problems to solve which I added TODO comments with questions.
Also for me it's unclear how to add size check in C code. I added method and definitions as in nullCheck, but I don't understand where this method should be called.
Would be appreciated if you help and/or point me to places using which I will be able to finish this PR ( #868 depends on this feature).
Thanks in advance.