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 _bulk_docs crash when provided revision can't be parsed #1897

Merged
merged 2 commits into from Feb 5, 2019

Conversation

@eiri
Copy link
Member

@eiri eiri commented Feb 1, 2019

Overview

If a doc's revision provided with _bulk_docs matches the expected length it assumed to be a parsable hexadecimal. When this is not the case couch_doc:couch_doc:from_json_obj_validate/2 function crashes with badarg.

The fix catches the exception and re-throws it as a doc_validation exception to raise "400 Bad Request" error.

Testing recommendations

make eunit apps=couch suites=couch_doc_json_tests or the manual stps from case #1895

Related Issues or Pull Requests

Closes #1895

Checklist

  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;
src/couch/src/couch_doc.erl Show resolved Hide resolved
Loading
@eiri eiri force-pushed the fix-bulk_docs-invalid-rev-crash branch from 57c0f04 to 4568979 Feb 5, 2019
@eiri eiri merged commit 9517b26 into master Feb 5, 2019
1 check passed
Loading
@eiri eiri deleted the fix-bulk_docs-invalid-rev-crash branch Feb 5, 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
Linked issues

Successfully merging this pull request may close these issues.

3 participants