laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/27167 )


Change subject: tlv: Don't raise exception if somebody passes empty data to TLV 
decoder
......................................................................

tlv: Don't raise exception if somebody passes empty data to TLV decoder

Change-Id: Id46994029d9b3cd6b67f4f7ee619466602cc8142
---
M pySim/tlv.py
1 file changed, 2 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/67/27167/1

diff --git a/pySim/tlv.py b/pySim/tlv.py
index 71338ab..bd332cc 100644
--- a/pySim/tlv.py
+++ b/pySim/tlv.py
@@ -228,6 +228,8 @@
         return self._encode_tag() + self._encode_len(val) + val

     def from_tlv(self, do: bytes):
+        if len(do) == 0:
+            return {}, b''
         (rawtag, remainder) = self.__class__._parse_tag_raw(do)
         if rawtag:
             if rawtag != self.tag:

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27167
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Id46994029d9b3cd6b67f4f7ee619466602cc8142
Gerrit-Change-Number: 27167
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>
Gerrit-MessageType: newchange

Reply via email to