Non-ASCII ALPN
martinthomson opened this issue · comments
Line 437 in 5757081
One fix is perhaps trivial: catch the decode error when adding to the list of extension values and just skip those. Real ALPN values are likely to be ASCII strings for now, so the only problem this might create is that people won't be able to configure aioquic with a non-ASCII protocol name.
Stack
handle: <Handle _SelectorDatagramTransport._read_ready()>
Traceback (most recent call last):
File "/usr/lib64/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/lib64/python3.11/asyncio/selector_events.py", line 1169, in _read_ready
self._protocol.datagram_received(data, addr)
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/asyncio/server.py", line 149, in datagram_received
protocol.datagram_received(data, addr)
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/asyncio/protocol.py", line 135, in datagram_received
self._quic.receive_datagram(cast(bytes, data), addr, now=self._loop.time())
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/quic/connection.py", line 980, in receive_datagram
is_ack_eliciting, is_probing = self._payload_received(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/quic/connection.py", line 2260, in _payload_received
frame_handler(context, frame_type, buf)
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/quic/connection.py", line 1498, in _handle_crypto_frame
self.tls.handle_message(event.data, self._crypto_buffers)
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/tls.py", line 1272, in handle_message
self._server_handle_hello(
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/tls.py", line 1586, in _server_handle_hello
peer_hello = pull_client_hello(input_buf)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/tls.py", line 557, in pull_client_hello
pull_list(buf, 2, pull_extension)
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/tls.py", line 382, in pull_list
items.append(func())
^^^^^^
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/tls.py", line 541, in pull_extension
hello.alpn_protocols = pull_list(
^^^^^^^^^^
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/tls.py", line 382, in pull_list
items.append(func())
^^^^^^
File "/home/jesup/src/mozilla/inbound_merge/obj-debug/_virtualenvs/wpt/lib/python3.11/site-packages/aioquic/tls.py", line 441, in pull_alpn_protocol
return pull_opaque(buf, 1).decode("ascii")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xba in position 0: ordinal not in range(128)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This is now fixed and will be in the next release.