Fix UBJSON parser crashes with unknown types (Issue #57)#58
Open
zarfld wants to merge 2 commits into
Open
Conversation
- Add comprehensive error recovery for unknown UBJSON types 73, 114, etc. - Prevent Node.js process crashes with graceful degradation - Enhanced buffer validation and recovery mechanisms - Improved workingSet integrity validation - Added robust recovery scanning for corrupted data streams - Maintain parsing functionality while handling PreSonus extensions - Comprehensive error analysis and debug logging - Tested with StudioLive 32SC firmware 3.2.0.108461 Changes: - ubjson.ts: Complete error recovery system with analysis logging - zlibUtil.ts: Null payload validation and error indicators - ZB.ts: Graceful packet handling with try-catch protection This allows stable mixer control applications on newer PreSonus firmware while maintaining backwards compatibility with existing functionality.
Owner
|
I think there's too many changes in this one PR, it's deviated from the required change. |
…ery logic\n- Revert try/catch wrappers in ZB/zlibUtil\n- Keep minimal UBJSON extensions: 0x49 (I), 0x72 (r)\n- Preserve original int64 BigInt behavior
featherbear
reviewed
May 15, 2026
| } | ||
|
|
||
| // PreSonus extension: type 114 (0x72 = 'r') - string type | ||
| case 0x72 /* r */: { |
Owner
There was a problem hiding this comment.
Do you have an example property which uses this type?
Author
There was a problem hiding this comment.
Need to check. That was some time ago so i dint remember exactly. But i think i can get examples for reference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem 🐛
Node.js process crashes when connecting to StudioLive 32SC mixers due to unknown UBJSON types (type 73, type 114, etc.) in the data stream. This affects newer PreSonus firmware and makes the API unsuitable for production mixer control systems.
Before Fix:
Solution ✅
Comprehensive error recovery system that prevents crashes while maintaining functionality:
Key Improvements:
Files Changed:
src/lib/util/zlib/ubjson.ts- Complete error recovery systemsrc/lib/util/zlib/zlibUtil.ts- Payload validation and error indicatorssrc/lib/packetParser/ZB.ts- Packet-level error protectionTesting 🧪
Hardware Validated:
Results:
Test Output:
Impact Assessment 📈
Production Benefits:
Before vs After:
Technical Details 🔧
Error Recovery Strategy:
PreSonus Extensions Handled:
Related Issues 🔗
Fixes #57 - UBJSON Parser Error: Unknown type 73 crashes Node.js process on StudioLive 32SC
Pattern Recognition:
Community Impact 🌟
This fix enables:
Request for Review 👀
@featherbear - This implements the graceful error handling approach discussed in the issue. The solution:
Would appreciate feedback on the implementation approach and any suggestions for further improvements!
Testing Environment: