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

Return allocation error in deserialize instead of panicking #238

Merged
merged 1 commit into from
Nov 9, 2020
Merged

Return allocation error in deserialize instead of panicking #238

merged 1 commit into from
Nov 9, 2020

Conversation

epilys
Copy link
Contributor

@epilys epilys commented Nov 8, 2020

There's no way to catch allocation errors since out of memory errors
cause an abort. Fail gracefully by returning the error instead of
panicking.

I happened upon this error when deserializing untrusted data with bincode. Bincode provides a byte limit bound but for sequences it's not possible to enforce this through serde since collection types like smallvec handle their own allocation.

There's no way to catch allocation errors since out of memory errors
cause an abort. Fail gracefully by returning the error instead of
panicking.
@mbrubeck
Copy link
Collaborator

mbrubeck commented Nov 8, 2020

@bors-servo r+

Thanks!

@bors-servo
Copy link
Contributor

📌 Commit d1394a0 has been approved by mbrubeck

@bors-servo
Copy link
Contributor

⌛ Testing commit d1394a0 with merge c7af9e2...

@bors-servo
Copy link
Contributor

☀️ Test successful - checks-travis
Approved by: mbrubeck
Pushing c7af9e2 to master...

@bors-servo bors-servo merged commit c7af9e2 into servo:master Nov 9, 2020
mbrubeck added a commit to mbrubeck/rust-smallvec that referenced this pull request Nov 16, 2020
Change log:

* Add the `append` method (servo#237).
* Add support for more array sizes between 17 and 31 (servo#234).
* Don't panic on deserialization errors (servo#238).
@mbrubeck mbrubeck mentioned this pull request Nov 16, 2020
bors-servo added a commit that referenced this pull request Nov 17, 2020
Version 1.5.0

Change log:

* Add the `append` method (#237).
* Add support for more array sizes between 17 and 31 (#234).
* Don't panic on deserialization errors (#238).
epilys added a commit to meli/meli that referenced this pull request Nov 22, 2020
Fixes panicking when loading cached serialized email from older versions
of meli.

servo/rust-smallvec#238
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants