Skip to content

Fix the heap-use-after-free risk caused by direct deconstruction when it is not used after initialization. #274

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

Merged
merged 1 commit into from
Mar 17, 2020

Conversation

WoodsCumming
Copy link
Contributor

@WoodsCumming WoodsCumming commented Mar 14, 2020

… it is not used after initialization.

What is the purpose of the change

Fix the heap-use-after-free risk caused by direct deconstruction when it is not used after initialization.

Brief changelog

Fix the heap-use-after-free risk caused by direct deconstruction when it is not used after initialization.

Verifying this change

Want a code review.

The ASAN Report

[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from MQClientManagerTest
[ RUN ] MQClientManagerTest.getClientFactory

==124436==ERROR: AddressSanitizer: heap-use-after-free on address 0x6110000096f8 at pc
0x7efe51699cba bp 0x7efe4bdfac20 sp 0x7efe4bdfac18
WRITE of size 8 at 0x6110000096f8 thread T4 (RemotingAsioT)
[ OK ] MQClientManagerTest.getClientFactory (14 ms)
[ RUN ] MQClientManagerTest.removeClientFactory
[ OK ] MQClientManagerTest.removeClientFactory (0 ms)
[----------] 2 tests from MQClientManagerTest (14 ms total)
[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (14 ms total)
[ PASSED ] 2 tests.

Follow this checklist to help us incorporate your contribution quickly and easily. Notice, it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when a cross-module dependency exists.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

@WoodsCumming WoodsCumming changed the title Fix the heap-use-after-free risk caused by direct deconstruction when… Fix the heap-use-after-free risk caused by direct deconstruction when it is not used after initialization. Mar 14, 2020
@codecov-io
Copy link

Codecov Report

Merging #274 into master will increase coverage by 0.26%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #274      +/-   ##
==========================================
+ Coverage   58.28%   58.54%   +0.26%     
==========================================
  Files         182      182              
  Lines       11805    11810       +5     
==========================================
+ Hits         6880     6914      +34     
+ Misses       4925     4896      -29     
Impacted Files Coverage Δ
src/MQClientFactory.cpp 22.90% <44.44%> (+2.12%) ⬆️
test/src/MQClientManagerTest.cpp 100.00% <100.00%> (ø)
src/MQClientAPIImpl.cpp 24.89% <0.00%> (+0.41%) ⬆️
src/transport/TcpRemotingClient.cpp 13.76% <0.00%> (+4.49%) ⬆️

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 753ec41...b79abb4. Read the comment docs.

@ShannonDing ShannonDing added the enhancement New feature or request label Mar 15, 2020
@ShannonDing ShannonDing added this to the 2.1.0 milestone Mar 15, 2020
@ShannonDing ShannonDing merged commit 9ddb626 into apache:master Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

heap-use-after-free risk caused by direct deconstruction in factory manager test.
3 participants