Skip to content

Conversation

@pgj
Copy link
Contributor

@pgj pgj commented May 3, 2023

Certain configurations of unsatisfiable field ranges could cause HTTP 500 because they are not handled, for example:

{"$and": [{"field": {"$eq": N}}, {"field": {"$gt": N}}]}

This makes mango_idx_view:end_key/1 fail because there is no clause to cover [{'$gt',35,'$eq',35}], the value that the selector becomes mapped to.

Similar field ranges are somewhat already handled by being mapped to empty so this seems to be an oversight in the original implementation. Consider the following case, which will not crash on the contrary:

{"$and": [{"field": {"$gt": N}}, {"field": {"$eq": N}}]}

Add the missing function clauses to fix this problem.

Checklist

  • Code is written and works correctly
  • Changes are covered by tests

Certain configurations of unsatisfiable field ranges could cause
HTTP 500 because they are not handled, for example:

    {"$and": [{"field": {"$eq": N}}, {"field": {"$gt": N}}]}

This makes `mango_idx_view:end_key/1` fail because there is no
clause to cover `[{'$gt',35,'$eq',35}]`, the value that the
selector becomes mapped to.

Similar field ranges are somewhat already handled by being mapped
to `empty` so this seems to be an oversight in the original
implementation.  Consider the following case, which will not
crash on the contrary:

    {"$and": [{"field": {"$gt": N}}, {"field": {"$eq": N}}]}

Add the missing function clauses to fix this problem.

Found by:	random query generation
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.

1 participant