| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
When a filter or validate function throws null, the global event loop in loop.js unsafely tries to access its properties, crashing couchjs. This adds safe null checks to the global handler to prevent complete denial of service.
|
our pull request template is not optional. |
Sorry, something went wrong.
|
Thanks for letting me know. I've updated the pull request description to use the standard template. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Overview
This PR fixes a critical unhandled exception bug in the global query server event loop (loop.js).
If a user document filter function throws null or undefined, the unhandled null bubbles up directly to handleError(e) in loop.js. This function immediately accesses e[0], throwing a TypeError: Cannot read properties of null. Because handleError has no error boundary of its own, this completely crashes the couchjs OS process, failing the query system.
A similar unsafe pattern exists in validate.js.
This patch adds explicit null checks to the global event handler, preventing arbitrary null exceptions from causing a full couchjs denial-of-service, ensuring they are properly returned as error messages over JSON instead.
Testing recommendations
These changes can be tested by creating a design document with a filter function that explicitly throws null, and observing that the query server gracefully returns an error message rather than crashing the couchjs process.
Related Issues or Pull Requests
None
Checklist