Attention is currently required from: fixeria, neels.

dexter has posted comments on this change by dexter. ( 
https://gerrit.osmocom.org/c/pysim/+/42662?usp=email )

Change subject: ts_51_011/EF.SMSP: fix handling of 'alpha_id' field
......................................................................


Patch Set 5:

(2 comments)

Patchset:

PS5:
This should fix the problem with EF.SMSP. Please also have a look at the patch 
before this one.


File pySim/ts_51_011.py:

https://gerrit.osmocom.org/c/pysim/+/42662/comment/49808e36_8244a436?usp=email :
PS5, Line 344:         self._construct = 
Struct('alpha_id'/GsmOrUcs2Adapter(Rpad(Bytes(this._.total_len-28))),
If we leave out the COptional, we make the parser more sensitive to broken file 
contents (see also the patch before this one. This were the bugs that were 
caught by the tests when I pushed this patch.

The reason why the parser gets more sensitive towards invalid input is the 
following: See: https://construct.readthedocs.io/en/latest/misc.html#conditional
"Attempts to parse or build the subconstruct. If it fails during parsing, 
returns a None. If it fails during building, it puts nothing into the stream."

In my opinion the parser should reject invalid input and not try to make sense 
of some broken input. That is why I prefer to remove the COptional from the 
construct definition.

YFI: When the alpha_id is not present, we get the following results during 
decode:
With COptional: alpha_id : 'null'
Without COptional: alpha_id : ''



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

Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I0ec99b2648b22c56f9145345e4cd8776f9217701
Gerrit-Change-Number: 42662
Gerrit-PatchSet: 5
Gerrit-Owner: dexter <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Attention: neels <[email protected]>
Gerrit-Attention: fixeria <[email protected]>
Gerrit-Comment-Date: Thu, 23 Apr 2026 14:06:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Reply via email to