-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Max allocation on invalid string input #92
Comments
@Thomasvdam, coming down the pipeline :) |
@Thomasvdam, i'll release this in the next version. Should be dropping by end of week |
Amazing, thank you for picking this up on such a short notice! |
@Thomasvdam, for safety, I do recommend setting a default value for every type, so you should go ahead and do that. When parsing an incorrect type, it should just ignore it if not assignable. |
I'm not quite sure what you mean by this, I get errors on both @json
class InvalidAttributeWithDefault {
value: string = "";
}
@json
class InvalidAttribute {
value!: string;
} Regardless, |
First of all thanks for all the work on this library, it's been incredibly useful to us!
We ran into an issue where AssemblyScript complained that we were allocating too much memory (
Allocation too large in ~lib/rt/itcms.ts(261:31)
) and after some digging we found that the error originated in the string parsing when a value was incorrectly typed as a string but the received JSON value was a single digit number.While the fault ultimately was with us not typing the expected JSON correctly we think it might be useful to have the string deserialiser do some sanity checks on the input and abort with a more helpful error message.
If this is something you'd be interested in adding to the library we can work on it and submit a PR. :)
Reproduction scenario in a test file:
Outputs:
The text was updated successfully, but these errors were encountered: