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

Bump serde from 1.0.133 to 1.0.136 #3402

Closed
wants to merge 1 commit into from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 26, 2022

Bumps serde from 1.0.133 to 1.0.136.

Release notes

Sourced from serde's releases.

v1.0.136

  • Improve default error message when Visitor fails to deserialize a u128 or i128 (#2167)

v1.0.135

  • Update discord channels listed in readme

v1.0.134

  • Improve error messages on deserializing NonZero integers from a 0 value (#2158)
Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added A-dependencies Area: Dependency file updates A-rust Area: Updates to Rust code P-Low ❄️ labels Jan 26, 2022
@codecov
Copy link

codecov bot commented Jan 26, 2022

Codecov Report

Merging #3402 (9095712) into main (ac662df) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #3402      +/-   ##
==========================================
+ Coverage   80.10%   80.11%   +0.01%     
==========================================
  Files         290      290              
  Lines       32841    32841              
==========================================
+ Hits        26306    26312       +6     
+ Misses       6535     6529       -6     

@dconnolly
Copy link
Contributor

dconnolly commented Jan 27, 2022

Copy link
Contributor

@dconnolly dconnolly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Requesting changes' to block for now

@teor2345
Copy link
Contributor

teor2345 commented Jan 27, 2022

This introduces a new Buf type that has an as_str method that uses unsafe:

This function is unsafe because it does not check that the bytes passed to it are valid UTF-8. If this constraint is violated, undefined behavior results, as the rest of Rust assumes that &strs are valid UTF-8.

https://doc.rust-lang.org/std/str/fn.from_utf8_unchecked.html#safety

This is safe because write_str makes sure that the whole string is always written to the buffer. Since the input strings are all valid UTF-8, and concatenated valid UTF-8 strings are also valid, the buffer is always valid UTF-8.

(A safety comment in serde would be nice though.)

@dependabot dependabot bot force-pushed the dependabot/cargo/serde-1.0.136 branch from 65ccd5e to c97badf Compare January 27, 2022 00:45
@dconnolly
Copy link
Contributor

This introduces a new Buf type that has an as_str method that uses unsafe:

This function is unsafe because it does not check that the bytes passed to it are valid UTF-8. If this constraint is violated, undefined behavior results, as the rest of Rust assumes that &strs are valid UTF-8.

https://doc.rust-lang.org/std/str/fn.from_utf8_unchecked.html#safety

This is safe because write_str makes sure that the whole string is always written to the buffer. Since the input strings are all valid UTF-8, and concatenated valid UTF-8 strings are also valid, the buffer is always valid UTF-8.

(A safety comment in serde would be nice though.)

Even though one can create an arbitrary slice of bytes with Buf::new()?

@teor2345
Copy link
Contributor

Even though one can create an arbitrary slice of bytes with Buf::new()?

Nice catch!

Yes, this is a safety bug, because the initial bytes data doesn't have to be UTF-8.

Here's an example that I think shows the bug (0xfe is invalid in UTF-8 regardless of context):

let bytes = [0xfe];
let buf = Buf::new(&mut bytes);
let bad_str = buf.as_str();

Here is the reference I used for invalid UTF-8:
https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt

But it's safe as currently used, because it is a private type that gets initialised with a zero-filled buffer:
serde-rs/serde@v1.0.133...v1.0.136#diff-3fe2f7b5e15c5b4043e41ea777df0b69f2e51947ce83a52fca7a0e53fce27699R1371-R1373

Did you want to open a bug against serde?

@dependabot dependabot bot force-pushed the dependabot/cargo/serde-1.0.136 branch from c97badf to 555f59f Compare January 28, 2022 21:45
@dependabot dependabot bot force-pushed the dependabot/cargo/serde-1.0.136 branch 2 times, most recently from a3082b8 to a71bce5 Compare February 5, 2022 05:08
@dependabot dependabot bot force-pushed the dependabot/cargo/serde-1.0.136 branch 3 times, most recently from a84bcfc to 7879b4e Compare February 14, 2022 16:02
@dependabot dependabot bot force-pushed the dependabot/cargo/serde-1.0.136 branch 4 times, most recently from 3af255b to c3bab5e Compare February 18, 2022 03:55
@dependabot dependabot bot force-pushed the dependabot/cargo/serde-1.0.136 branch 4 times, most recently from 09e6d98 to 3f711a9 Compare February 22, 2022 22:20
@dependabot dependabot bot force-pushed the dependabot/cargo/serde-1.0.136 branch from 3f711a9 to 6b10cd6 Compare March 1, 2022 03:34
@conradoplg
Copy link
Collaborator

Should we make the bump since the bug can't be triggered externally, or block on this? @dconnolly would you like someone else to report the bug upstream?

@teor2345
Copy link
Contributor

teor2345 commented Mar 2, 2022

Should we make the bump since the bug can't be triggered externally, or block on this? @dconnolly would you like someone else to report the bug upstream?

I think it's fine to just merge this PR.

We're not reviewing standard library updates or transitive dependency updates in this level of detail, so I think we can be less detailed in our other dependency reviews.

@dependabot dependabot bot force-pushed the dependabot/cargo/serde-1.0.136 branch from 610346d to 8755a9d Compare March 2, 2022 02:46
dconnolly
dconnolly previously approved these changes Mar 2, 2022
@teor2345
Copy link
Contributor

teor2345 commented Mar 2, 2022

We'll need to mergifyio refresh this PR once the fix in PR #3705 merges.

@dependabot dependabot bot force-pushed the dependabot/cargo/serde-1.0.136 branch from 8755a9d to 9e057ec Compare March 3, 2022 00:41
@dependabot dependabot bot requested a review from a team as a code owner March 3, 2022 00:41
@dependabot dependabot bot requested review from upbqdn and removed request for a team March 3, 2022 00:41
@dconnolly
Copy link
Contributor

mergifyio refresh

dconnolly
dconnolly previously approved these changes Mar 3, 2022
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.133 to 1.0.136.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.133...v1.0.136)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/cargo/serde-1.0.136 branch from 79db06b to 9095712 Compare March 4, 2022 07:03
@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Mar 7, 2022

Looks like serde is up-to-date now, so this is no longer needed.

@dependabot dependabot bot closed this Mar 7, 2022
@dependabot dependabot bot deleted the dependabot/cargo/serde-1.0.136 branch March 7, 2022 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependencies Area: Dependency file updates A-rust Area: Updates to Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants