Skip to content

v0.3.0 MATLAB File Reader/Writer - Production Quality

Choose a tag to compare

@kolkov kolkov released this 22 Nov 10:55
· 3 commits to main since this release

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 files
  • WithDescription(string) - Set custom file description
  • WithCompression(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 name
  • MatFile.GetVariableNames() - Get list of all variables
  • MatFile.HasVariable(name) - Check if variable exists
  • Variable.GetFloat64Array() - Type-safe float64 extraction
  • Variable.GetInt32Array() - Type-safe int32 extraction
  • Variable.GetComplex128Array() - Complex number extraction
  • Variable.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.MaxInt check in internal/v5/writer.go:124 and internal/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_complex attribute detection in internal/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

🔄 Upgrade from v0.2.0

100% backward compatible - no breaking changes. Simply update your dependency:

go get -u github.com/scigolib/matlab

See CHANGELOG.md for complete details.