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

Do not read garbage CacheError markers #1395

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Conversation

Swatinem
Copy link
Member

Related to #1386. We have observed that cache cleanup fails because of a corrupted file.
That file contained a valid CacheError prefix, but then gigabytes worth of NUL-bytes, plus some garbage.

This change works around this corrupted file by only reading the valid CacheError prefix, and not more.

@Swatinem Swatinem self-assigned this Feb 29, 2024
@Swatinem Swatinem requested a review from a team as a code owner February 29, 2024 12:24
@Swatinem Swatinem enabled auto-merge (squash) February 29, 2024 12:25
@Swatinem Swatinem merged commit 02b1653 into master Feb 29, 2024
10 checks passed
@Swatinem Swatinem deleted the swatinem/safe-cleanup branch February 29, 2024 13:31
/// This reads the string only up to the first NUL-byte.
/// We have observed broken cache files which were not properly truncated.
/// They had a valid `CacheError` prefix, followed by gigabytes worth of NUL-bytes, and some junk at the end.
fn utf8_message(raw_message: &[u8]) -> Cow<'_, str> {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add some tests for this particular function. Wdyt @getsentry/processing?

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.

None yet

3 participants