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 crash while using user defined plugins #1290

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

tomjzzhang
Copy link
Contributor

The crash can occur when onComplete is called before response headers are available, but it tries to dereference the pointer. onComplete can be called when the client or server reset the stream / connection, which is a common case, especially under heavy load.

A more robust fix would be changing StreamDecoderCompletionCallback::onComplete to take Envoy::OptRef for the header, and actually check on whether it has value.

The fix currently works because there is only one call site that might have nullptr dereference, which happens to set success to false:

onComplete(false);

@tomjzzhang tomjzzhang changed the title Fix possible crash while using header plugins Fix possible crash while using user defined plugins Feb 11, 2025
@tomjzzhang tomjzzhang added the waiting-for-review A PR waiting for a review. label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-review A PR waiting for a review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant