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

Add defensive pointer boundary checks to log targets to avoid SEGFAUL… #95

Conversation

geier1993
Copy link
Contributor

…TS with raceconditions #89

@geier1993
Copy link
Contributor Author

We are still discussing a way to make the ChannelBuffer threadsafe (or maybe to find another solution)

@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (5faa507) 62.80% compared to head (d7d610e) 62.80%.

Files Patch % Lines
src/eckit/log/RotationTarget.cc 0.00% 2 Missing ⚠️
src/eckit/log/ChannelBuffer.cc 80.00% 1 Missing ⚠️
src/eckit/log/MonitorTarget.cc 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #95      +/-   ##
===========================================
- Coverage    62.80%   62.80%   -0.01%     
===========================================
  Files          790      790              
  Lines        45196    45193       -3     
===========================================
- Hits         28386    28383       -3     
  Misses       16810    16810              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@geier1993 geier1993 force-pushed the bugfix/89-segmentation-fault-caused-by-buffer-overflow-in-channelbuffer branch from 67706a9 to d7d610e Compare November 24, 2023 09:33
@@ -69,9 +67,10 @@ void ChannelBuffer::reset() {

bool ChannelBuffer::dumpBuffer() {
if (target_) {
target_->write(pbase(), pptr());
// Explicitly check that `pptr()` is not larger than end of buffer. Racecondition can end up adding larger values.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we be explicit that this is a race condition in the std library, rather than here.

@simondsmart simondsmart merged commit 3b46733 into develop Dec 6, 2023
32 checks passed
@simondsmart simondsmart deleted the bugfix/89-segmentation-fault-caused-by-buffer-overflow-in-channelbuffer branch December 6, 2023 11:39
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.

4 participants