Skip to content

[FEAT] yaml semver marshal/unmarshal#41

Merged
bbengfort merged 2 commits intomainfrom
jy
Mar 31, 2026
Merged

[FEAT] yaml semver marshal/unmarshal#41
bbengfort merged 2 commits intomainfrom
jy

Conversation

@bbengfort
Copy link
Copy Markdown
Contributor

@bbengfort bbengfort commented Mar 31, 2026

Scope of changes

Adds YAML parsing to semver.

Type of change

  • new feature
  • bug fix
  • documentation
  • testing
  • technical debt
  • other (describe)

Author checklist

  • I have manually tested the change and/or added automation in the form of unit tests or integration tests
  • I have added new test fixtures as needed to support added tests

Note

Medium Risk
Moderate risk because it introduces new binary/YAML encoding paths and manual byte parsing that could affect interoperability or expose edge-case panics on malformed input.

Overview
Adds YAML support for semver.Version via MarshalYAML/UnmarshalYAML, plus a new compact binary encoding with MarshalBinary/UnmarshalBinary and an ErrDataSize error for invalid payloads.

Updates semver tests to round-trip versions through binary/text/JSON more thoroughly (YAML test stub is present but skipped), and adds yaml struct tags to region.Info so region metadata can be loaded from YAML in addition to JSON/env.

Written by Cursor Bugbot for commit 88e59c4. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

}

return nil
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnmarshalBinary panics on malformed input data

Medium Severity

UnmarshalBinary never checks the return value j from binary.Uvarint. When j == 0 (buffer too small) or j < 0 (overflow), the index i fails to advance correctly, leading to reading garbage. More critically, the slices data[i : i+int(c)] for PreRelease and BuildMeta have no bounds check — a crafted or corrupted input with a large length prefix c causes an out-of-bounds panic.

Fix in Cursor Fix in Web

@bbengfort bbengfort merged commit d00f9a5 into main Mar 31, 2026
4 checks passed
@bbengfort bbengfort deleted the jy branch March 31, 2026 17:46
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 this pull request may close these issues.

1 participant