laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/pysim/+/43984?usp=email )

Change subject: esim.saip: derive nb_rec from efFileSize when the descriptor 
omits it
......................................................................

esim.saip: derive nb_rec from efFileSize when the descriptor omits it

File.from_template copies the template's record count, so a profile whose
fileDescriptor carries no number of records but declares a larger
efFileSize kept the template default (EF.MSISDN: one 24-byte record from
FilesUsimOptional against a 68-byte, two-record file). ETSI TS 102 222
sizes a linear fixed EF as record length times record count; when the
descriptor is silent the declared size is the count.

The folder osmocom-pysim-saip-record-count of
hampushellsberg-dev/PySIM-upstream-patches on GitHub has the analysis
and a repro.

Change-Id: I191b234446c278a5252a903d170c3336d9e0c1ba
---
M pySim/esim/saip/__init__.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  neels: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve
  dexter: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 2833fd0..5966897 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -366,8 +366,8 @@
                 if fd_dec['record_len']:
                     self.rec_len = fd_dec['record_len']
                 if efFileSize:
-                    if self.rec_len and self.nb_rec == None:
-                        # compute the number of records from file size and 
record length
+                    if self.rec_len and not fd_dec['num_of_rec']:
+                        # the profile's size wins over a template count when 
the descriptor omits it
                         self.nb_rec = self._file_size // self.rec_len
                 if fdb_dec['structure'] == 'linear_fixed':
                     self.file_type = 'LF'

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/43984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I191b234446c278a5252a903d170c3336d9e0c1ba
Gerrit-Change-Number: 43984
Gerrit-PatchSet: 4
Gerrit-Owner: laforge <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-CC: hampushellsberg <[email protected]>

Reply via email to