v0.3.0 MATLAB File Reader/Writer - Production Quality
Production Quality Release
This release brings the library to production quality (Grade A-) with critical security fixes, modern API design, and comprehensive testing.
🎯 Key Features
Functional Options Pattern:
WithEndianness(binary.ByteOrder)- Set byte order for v5 filesWithDescription(string)- Set custom file descriptionWithCompression(int)- Set compression level 0-9- 100% backward compatible with existing API
API Convenience Methods (70% less boilerplate):
MatFile.GetVariable(name)- Direct variable access by nameMatFile.GetVariableNames()- Get list of all variablesMatFile.HasVariable(name)- Check if variable existsVariable.GetFloat64Array()- Type-safe float64 extractionVariable.GetInt32Array()- Type-safe int32 extractionVariable.GetComplex128Array()- Complex number extractionVariable.GetScalar()- Extract single scalar value
Testable Examples:
- 17 godoc examples with real, executable code
- All examples verified by
go test - Always-current documentation
🔒 Security Fixes
Security Fix #1: Tag Size Validation (High Priority):
- Issue: No validation on v5 tag sizes - potential memory exhaustion attack
- Impact: Malicious MAT files could specify huge sizes (4GB+)
- Fix: Added 2GB limit in
internal/v5/data_tag.go:53
Security Fix #2: Dimension Overflow Check (High Priority):
- Issue: No overflow check when calculating total array size
- Impact: Integer overflow could lead to incorrect buffer allocation
- Fix: Added
math.MaxIntcheck ininternal/v5/writer.go:124andinternal/v73/writer.go:98
Security Fix #3: v73 Complex Reading (Functionality):
- Issue: v73 complex number groups not properly detected during reading
- Impact: Round-trip failures for complex numbers in v7.3 format
- Fix: Added
MATLAB_complexattribute detection ininternal/v73/adapter.go:50
📊 Quality Metrics
- Grade: A- (Excellent) - Production Quality ⬆️
- Tests: 298 passing (100%) (+60 tests from v0.2.0)
- Coverage: 85.4% (+6.9% from v0.2.0)
- Linter: 0 errors, 0 warnings
- CI/CD: All checks GREEN on all platforms
✨ What's Included
- ✅ v5 Writer: Complete (all numeric types, complex, multi-dimensional)
- ✅ v7.3 Writer: Complete (HDF5-based)
- ✅ v5 Reader: Full support with critical bug fixes
- ✅ v7.3 Reader: Full HDF5 integration
- ✅ Round-trip verified: Both formats working perfectly
- ✅ Cross-platform: Windows, Linux, macOS
📦 Installation
go get github.com/scigolib/matlab📚 Documentation
- README.md - Quick start guide
- CHANGELOG.md - Detailed changes
- API Reference - Full API documentation
- Examples - 17 testable examples
🔄 Upgrade from v0.2.0
100% backward compatible - no breaking changes. Simply update your dependency:
go get -u github.com/scigolib/matlabSee CHANGELOG.md for complete details.