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 segfault if ce-specversion header missing #165

Merged
merged 1 commit into from
Jul 24, 2019

Conversation

prestona
Copy link
Contributor

If a HTTP request does not contain the ce-specversion header then the
process of converting the request to an event returns a nil
event and a non-fatal error value. Unfortunately, in this situation,
the code continued to process the request resulting in an attempt to
de-reference the nil event value.

Fix by adding an additional condition to the error handling. Now
conversions that yield a non-fatal error must also return a non-nil
event, otherwise a HTTP 400 (Bad Request) status is returned.

@prestona prestona force-pushed the no-specversion-segfault branch from 7047d51 to ca38263 Compare July 17, 2019 23:52
If a HTTP request does not contain the `ce-specversion` header then the
process of converting the request to an event returns a `nil`
event and a non-fatal error value. Unfortunately, in this situation,
the code continued to process the request resulting in an attempt to
de-reference the `nil` event value.

Fix by adding an additional condition to the error handling. Now
conversions that yield a non-fatal error must also return a non-nil
event, otherwise a HTTP 400 (Bad Request) status is returned.

Signed-off-by: Adrian Preston <prestona@uk.ibm.com>
@prestona prestona force-pushed the no-specversion-segfault branch from ca38263 to 08fcb4f Compare July 18, 2019 00:02
@n3wscott
Copy link
Member

oh nice catch!

/lgtm

@n3wscott n3wscott merged commit 9c1f61e into cloudevents:master Jul 24, 2019
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.

2 participants