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

Document validation infinite loop #796

Closed
radwaretaltr opened this issue Jun 5, 2023 · 2 comments · Fixed by #797
Closed

Document validation infinite loop #796

radwaretaltr opened this issue Jun 5, 2023 · 2 comments · Fixed by #797

Comments

@radwaretaltr
Copy link
Contributor

Hi,

We found out that in some cases, the Validate() method enters an infinite loop when validating a valid API document.

For example:
https://github.com/APIs-guru/openapi-directory/blob/51fed63e3e6bce022cedba44ce28863bd712040c/APIs/presalytics.io/ooxml/0.1.0/openapi.yaml

This happens because the "stack" slice isn't handled correctly in the validate receiver of "*Schema":
func (schema *Schema) validate(ctx context.Context, stack []*Schema) error

While the slice is being resliced during its lifecycle in the recursion, we do not store the resliced result and use the original slice instead.

NOTE: In order to load this spec, we had to set the "CircularReferenceCounter" to 20.

@radwaretaltr
Copy link
Contributor Author

Submitted a PR with the fix: #797.

@sambercovici
Copy link

@fenollp , can you please confirm the problem and assis?

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 a pull request may close this issue.

2 participants