pysim/pySim
Harald Welte c975251a48 filesystem: Don't pass empty string to parse_select_response()
This happens e.g. when selecting the ARA-M applet on sysmoISIM-SJA2:

pySIM-shell (MF)> select ADF.ARA-M
-> 00a4040409 a00000015141434c00
<- 9000:
Traceback (most recent call last):
  File "/space/home/laforge/.local/lib/python3.9/site-packages/cmd2/cmd2.py", line 2064, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
  File "/space/home/laforge/.local/lib/python3.9/site-packages/cmd2/cmd2.py", line 2494, in onecmd
    stop = func(statement)
  File "/space/home/laforge/projects/git/pysim/./pySim-shell.py", line 750, in do_select
    fcp_dec = self._cmd.rs.select(path, self._cmd)
  File "/space/home/laforge/projects/git/pysim/pySim/filesystem.py", line 1314, in select
    select_resp = f.decode_select_response(data)
  File "/space/home/laforge/projects/git/pysim/pySim/filesystem.py", line 193, in decode_select_response
    return self.parent.decode_select_response(data_hex)
  File "/space/home/laforge/projects/git/pysim/pySim/filesystem.py", line 378, in decode_select_response
    return profile.decode_select_response(data_hex)
  File "/space/home/laforge/projects/git/pysim/pySim/ts_102_221.py", line 796, in decode_select_response
    t.from_tlv(h2b(resp_hex))
  File "/space/home/laforge/projects/git/pysim/pySim/tlv.py", line 231, in from_tlv
    (rawtag, remainder) = self.__class__._parse_tag_raw(do)
  File "/space/home/laforge/projects/git/pysim/pySim/tlv.py", line 258, in _parse_tag_raw
    return bertlv_parse_tag_raw(do)
  File "/space/home/laforge/projects/git/pysim/pySim/utils.py", line 208, in bertlv_parse_tag_raw
    if binary[0] == 0xff and len(binary) == 1 or binary[0] == 0xff and binary[1] == 0xff:
IndexError: bytearray index out of range
EXCEPTION of type 'IndexError' occurred with message: 'bytearray index out of range'

Change-Id: I910e6deba27d1483dff1e986c89f1a1b2165f49b
2022-02-14 00:44:55 +01:00
..
transport cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
__init__.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
ara_m.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
card_handler.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
card_key_provider.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
cards.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
cat.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
commands.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
construct.py construct: Add Construct for variable-length int 'GreedyInteger' 2022-02-14 00:41:24 +01:00
exceptions.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
filesystem.py filesystem: Don't pass empty string to parse_select_response() 2022-02-14 00:44:55 +01:00
gsm_r.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
iso7816_4.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
jsonpath.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
profile.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
sysmocom_sja2.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
tlv.py tlv: Convert CamelCase class name to snake_case in json 2022-02-12 08:33:37 +00:00
ts_31_102.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
ts_31_103.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
ts_51_011.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
ts_102_221.py cosmetic: Switch to consistent four-spaces indent; run autopep8 2022-02-11 13:32:58 +01:00
utils.py utils: Fix missing Optional[] in type annotations 2022-02-11 13:32:58 +01:00