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

Fix possible data corruption from deserializing error details twice #586

Merged
merged 1 commit into from
Oct 19, 2020

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented Oct 19, 2020

The MessagePackFormatter would deserialize error details twice. The first happened with a live buffer. The second one happened sometime later, concurrently with another thread that is clearing/recycling the buffer. This led to non-deterministic behavior including returning null as the error details but could also lead to reading corrupted data due to use of a recycled buffer.

Fixes #585

The MessagePackFormatter would deserialize error details twice. The first happened with a live buffer. The second one happened sometime later, concurrently with another thread that is clearing/recycling the buffer. This led to non-deterministic behavior including returning null as the error details but could also lead to reading corrupted data due to use of a recycled buffer.

Fixes microsoft#585
@AArnott AArnott added this to the v2.7 milestone Oct 19, 2020
@AArnott AArnott requested a review from milopezc October 19, 2020 21:48
@AArnott AArnott self-assigned this Oct 19, 2020
@codecov-io
Copy link

codecov-io commented Oct 19, 2020

Codecov Report

Merging #586 into master will increase coverage by 3.48%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #586      +/-   ##
==========================================
+ Coverage   86.44%   89.92%   +3.48%     
==========================================
  Files          40       54      +14     
  Lines        3084     4488    +1404     
  Branches      593        0     -593     
==========================================
+ Hits         2666     4036    +1370     
- Misses        302      452     +150     
+ Partials      116        0     -116     
Impacted Files Coverage Δ
src/StreamJsonRpc/MessagePackFormatter.cs 91.77% <ø> (+2.20%) ⬆️
src/StreamJsonRpc/Protocol/JsonRpcError.cs 76.19% <ø> (+4.76%) ⬆️
...mJsonRpc/EventArgs/JsonRpcDisconnectedEventArgs.cs 57.14% <0.00%> (-31.10%) ⬇️
...eamJsonRpc/Exceptions/RemoteInvocationException.cs 42.85% <0.00%> (-14.29%) ⬇️
src/StreamJsonRpc/WebSocketMessageHandler.cs 86.79% <0.00%> (-13.21%) ⬇️
src/StreamJsonRpc/JsonRpcProxyOptions.cs 90.00% <0.00%> (-10.00%) ⬇️
src/StreamJsonRpc/Utilities.cs 93.75% <0.00%> (-6.25%) ⬇️
src/StreamJsonRpc/LengthHeaderMessageHandler.cs 94.87% <0.00%> (-5.13%) ⬇️
src/StreamJsonRpc/JsonRpcEventSource.cs 6.66% <0.00%> (-0.66%) ⬇️
src/StreamJsonRpc/AwaitExtensions.cs 100.00% <0.00%> (ø)
... and 44 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5807ddf...daa4f29. Read the comment docs.

@AArnott AArnott merged commit 57bc060 into microsoft:master Oct 19, 2020
@AArnott AArnott deleted the fix585 branch October 19, 2020 23:07
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.

MessagePackFormatter may deserialize ErrorDetails.Data twice, leading to data corruption the second time
3 participants