Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for the max length in BerTLV prefix #256

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

alovak
Copy link
Contributor

@alovak alovak commented Jul 25, 2023

In the spec I'm working with now, there is a max length for BerTLV fields.

Currently, we are ignoring the Length (max length) of the field spec for prefix.BerTLV. This PR changes the prefix a little bit:

  • if Length is set to 0 or is not set (0 is zero value used for the Length anyway) - we do not check max length - this is to support current integrations which, most probably, follow the example from our tests like this:
				Subfields: map[string]field.Field{
					"9A": field.NewString(&field.Spec{
						Description: "Transaction Date",
						Enc:         encoding.Binary,
						Pref:        prefix.BerTLV,
					}),
					"9F02": field.NewString(&field.Spec{
						Description: "Amount, Authorized (Numeric)",
						Enc:         encoding.Binary,
						Pref:        prefix.BerTLV,
					}),
				},
  • if Length is set to non-zero value, perform the check

This PR is a breaking change (potentially) if you use the prefix.BerTLV and set non-zero Length in the field spec.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 75.00% and project coverage change: +0.05% 🎉

Comparison is base (026d31c) 73.43% compared to head (93bf5ae) 73.49%.
Report is 1 commits behind head on master.

❗ Current head 93bf5ae differs from pull request most recent head 105736b. Consider uploading reports for the commit 105736b to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #256      +/-   ##
==========================================
+ Coverage   73.43%   73.49%   +0.05%     
==========================================
  Files          43       43              
  Lines        2270     2290      +20     
==========================================
+ Hits         1667     1683      +16     
- Misses        373      375       +2     
- Partials      230      232       +2     
Files Changed Coverage Δ
field/composite.go 83.22% <60.00%> (ø)
field/bitmap.go 71.05% <75.00%> (+0.29%) ⬆️
prefix/bertlv.go 87.87% <83.33%> (-4.13%) ⬇️
message.go 71.30% <100.00%> (+0.52%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alovak alovak merged commit 3cfa4c0 into master Jul 26, 2023
6 checks passed
@alovak alovak deleted the check-max-length-for-bertlv-prefix branch July 26, 2023 11:59
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.

3 participants