Skip to content

Conversation

anweiss
Copy link
Owner

@anweiss anweiss commented Aug 22, 2025

Clean up the VSCode extension

anweiss added 13 commits August 22, 2025 11:09
This commit fixes issue #248 where validating recursive CDDL structures
would cause a stack overflow due to infinite recursion.

Changes:
- Added recursion detection to CBORValidator using visited_rules HashSet
- Track visited rules during validation to prevent cycles
- Allow recursive references by returning Ok() when a cycle is detected
- Added comprehensive test case for recursive structure validation
- Added helper method new_with_recursion_state() for proper state transfer

The fix ensures that recursive structures like:

Can be validated without causing stack overflow while maintaining
validation correctness.
- Add visited_rules HashSet field to JSONValidator struct
- Implement recursion detection in visit_identifier method
- Handle recursive rule references in array processing
- Add comprehensive tests for JSON validator recursion protection
- Ensure both CBOR and JSON validators are protected against infinite recursion

This extends the fix for issue #248 to cover both CBOR and JSON validation,
providing comprehensive protection against stack overflow in recursive CDDL structures.
@anweiss anweiss self-assigned this Aug 22, 2025
@anweiss anweiss marked this pull request as ready for review August 22, 2025 17:26
@anweiss anweiss merged commit 95081d8 into main Aug 22, 2025
15 checks passed
@anweiss anweiss deleted the cddl-lsp-rewrite branch August 22, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant