Skip to content

fix(middleware): reject negative Recover stack sizes - #3210

Open
anqorithm wants to merge 1 commit into
labstack:masterfrom
anqorithm:anqorithm/fix-recover-stack-size
Open

anqorithm wants to merge 1 commit into
labstack:masterfrom
anqorithm:anqorithm/fix-recover-stack-size

Conversation

@anqorithm

Copy link
Copy Markdown

A negative RecoverConfig.StackSize is accepted during setup, then make([]byte, config.StackSize) panics inside the recovery defer when a handler panics. Reject the invalid size in ToMiddleware, so the error-returning API reports it and RecoverWithConfig fails at construction rather than while recovering a request.

The regression fails before the fix. Full race tests, build, go vet, staticcheck, golint and diff checks pass. The zero-value default and positive stack sizes retain their existing behavior.

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