prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Incorrect RTCP SR + RR parsing
  ### Brief description
  
  The RTCP parser fails to handle a packet that contains both Sender Report and Received Report, which is is the most common data for a two-way session.
  
  It seems that the "sender_info" info contain a payload, this should be parsed as a ReceptionReport info
  
  Incorrect behavior demonstrated in UTS here: https://github.com/secdev/scapy/commit/0bb9db2932d91d2f6e057caea60db78a2ad54f96
  
  ### Scapy version
  
  main
  
  ### Python version
  
  3.10
  
  ### Operating system
  
  Linux 5.15.146
  
  ### Additional environment information
  
  _No response_
  
  ### How to reproduce
  
  Run tests on provided branch:
  
  `test/run_tests  -P "load_contrib('rtcp')" -t test/contrib/rtcp.uts -F`
  
  
  
  ### Actual result
  
  Demo test should fail.
  
  ReceptionReport after SenderInfo should be parsed. SenderInfo should never have a payload, it's a fixed-sized struct
  
  ### Expected result
  
  The commented asserts should pass instead
  
  ### Related resources
  
  https://datatracker.ietf.org/doc/html/rfc3550
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `scapy/contrib/rtcp.py`
  Content:
  ```
  1 # SPDX-License-Identifier: GPL-2.0-only
  2 # This file is part of Scapy
  3 # See https://scapy.net/ for more information
  4 # Copyright (C) Pavel Oborin <oborin.p@gmail.com>
  5 
  6 # RFC 3550
  7 # scapy.contrib.description = Real-Time Transport Control Protocol
  8 # scapy.contrib.status = loads
  9 
  10 """
  11 RTCP (rfc 3550)
  12 
  13 Use bind_layers(UDP, RTCP, dport=...) to start using it
  14 """
  15 
  16 import struct
  17 
  18 from scapy.packet import Packet
  19 from scapy.fields import (
  20     BitField,
  21     BitFieldLenField,
  22     ByteEnumField,
  23     ByteField,
  24     ConditionalField,
  25     FieldLenField,
  26     IntField,
  27     LenField,
  28     LongField,
  29     PacketField,
  30     PacketListField,
  31     StrLenField,
  32     X3BytesField,
  33 )
  34 
  35 
  36 _rtcp_packet_types = {
  37     200: 'Sender report',
  38     201: 'Receiver report',
  39     202: 'Source description',
  40     203: 'BYE',
  41     204: 'APP'
  42 }
  43 
  44 
  45 class SenderInfo(Packet):
  46     name = "Sender info"
  47     fields_desc = [
  48         LongField('ntp_timestamp', None),
  49         IntField('rtp_timestamp', None),
  50         IntField('sender_packet_count', None),
  51         IntField('sender_octet_count', None)
  52     ]
  53 
  54 
  55 class ReceptionReport(Packet):
  56     name = "Reception report"
  57     fields_desc = [
  58         IntField('sourcesync', None),
  59         ByteField('fraction_lost', None),
  60         X3BytesField('cumulative_lost', None),
  61         IntField('highest_seqnum_recv', None),
  62         IntField('interarrival_jitter', None),
  63         IntField('last_SR_timestamp', None),
  64         IntField('delay_since_last_SR', None)
  65     ]
  66 
  67 
  68 _sdes_chunk_types = {
  69     0: "END",
  70     1: "CNAME",
  71     2: "NAME",
  72     3: "EMAIL",
  73     4: "PHONE",
  74     5: "LOC",
  75     6: "TOOL",
  76     7: "NOTE",
  77     8: "PRIV"
  78 }
  79 
  80 
  81 class SDESItem(Packet):
  82     name = "SDES item"
  83     fields_desc = [
  84         ByteEnumField('chunk_type', None, _sdes_chunk_types),
  85         FieldLenField('length', None, fmt='!b', length_of='value'),
  86         StrLenField('value', None, length_from=lambda pkt: pkt.length)
  87     ]
  88 
  89     def extract_padding(self, p):
  90         return "", p
  91 
  92 
  93 class SDESChunk(Packet):
  94     name = "SDES chunk"
  95     fields_desc = [
  96         IntField('sourcesync', None),
  97         PacketListField(
  98             'items', None,
  99             next_cls_cb=(
  100                 lambda x, y, p, z: None if (p and p.chunk_type == 0) else SDESItem
  101             )
  102         )
  103     ]
  104 
  105 
  106 class RTCP(Packet):
  107     name = "RTCP"
  108 
  109     fields_desc = [
  110         # HEADER
  111         BitField('version', 2, 2),
  112         BitField('padding', 0, 1),
  113         BitFieldLenField('count', 0, 5, count_of='report_blocks'),
  114         ByteEnumField('packet_type', 0, _rtcp_packet_types),
  115         LenField('length', None, fmt='!h'),
  116         # SR/RR
  117         ConditionalField(
  118             IntField('sourcesync', 0),
  119             lambda pkt: pkt.packet_type in (200, 201)
  120         ),
  121         ConditionalField(
  122             PacketField('sender_info', SenderInfo(), SenderInfo),
  123             lambda pkt: pkt.packet_type == 200
  124         ),
  125         ConditionalField(
  126             PacketListField('report_blocks', None, pkt_cls=ReceptionReport,
  127                             count_from=lambda pkt: pkt.count),
  128             lambda pkt: pkt.packet_type in (200, 201)
  129         ),
  130         # SDES
  131         ConditionalField(
  132             PacketListField('sdes_chunks', None, pkt_cls=SDESChunk,
  133                             count_from=lambda pkt: pkt.count),
  134             lambda pkt: pkt.packet_type == 202
  135         ),
  136     ]
  137 
  138     def post_build(self, pkt, pay):
  139         pkt += pay
  140         if self.length is None:
  141             pkt = pkt[:2] + struct.pack("!h", len(pkt) // 4 - 1) + pkt[4:]
  142         return pkt
  143
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/scapy/contrib/rtcp.py b/scapy/contrib/rtcp.py
  --- a/scapy/contrib/rtcp.py
  +++ b/scapy/contrib/rtcp.py
  @@ -51,6 +51,9 @@
           IntField('sender_octet_count', None)
       ]
   
  +    def extract_padding(self, p):
  +        return "", p
  +
   
   class ReceptionReport(Packet):
       name = "Reception report"
  @@ -64,6 +67,9 @@
           IntField('delay_since_last_SR', None)
       ]
   
  +    def extract_padding(self, p):
  +        return "", p
  +
   
   _sdes_chunk_types = {
       0: "END",
  
verification_info: {"golden_diff": "diff --git a/scapy/contrib/rtcp.py b/scapy/contrib/rtcp.py\n--- a/scapy/contrib/rtcp.py\n+++ b/scapy/contrib/rtcp.py\n@@ -51,6 +51,9 @@\n         IntField('sender_octet_count', None)\n     ]\n \n+    def extract_padding(self, p):\n+        return \"\", p\n+\n \n class ReceptionReport(Packet):\n     name = \"Reception report\"\n@@ -64,6 +67,9 @@\n         IntField('delay_since_last_SR', None)\n     ]\n \n+    def extract_padding(self, p):\n+        return \"\", p\n+\n \n _sdes_chunk_types = {\n     0: \"END\",\n", "issue": "Incorrect RTCP SR + RR parsing\n### Brief description\n\nThe RTCP parser fails to handle a packet that contains both Sender Report and Received Report, which is is the most common data for a two-way session.\r\n\r\nIt seems that the \"sender_info\" info contain a payload, this should be parsed as a ReceptionReport info\r\n\r\nIncorrect behavior demonstrated in UTS here: https://github.com/secdev/scapy/commit/0bb9db2932d91d2f6e057caea60db78a2ad54f96\n\n### Scapy version\n\nmain\n\n### Python version\n\n3.10\n\n### Operating system\n\nLinux 5.15.146\n\n### Additional environment information\n\n_No response_\n\n### How to reproduce\n\nRun tests on provided branch:\r\n\r\n`test/run_tests  -P \"load_contrib('rtcp')\" -t test/contrib/rtcp.uts -F`\r\n\r\n\n\n### Actual result\n\nDemo test should fail.\r\n\r\nReceptionReport after SenderInfo should be parsed. SenderInfo should never have a payload, it's a fixed-sized struct\n\n### Expected result\n\nThe commented asserts should pass instead\n\n### Related resources\n\nhttps://datatracker.ietf.org/doc/html/rfc3550\n", "before_files": [{"content": "# SPDX-License-Identifier: GPL-2.0-only\n# This file is part of Scapy\n# See https://scapy.net/ for more information\n# Copyright (C) Pavel Oborin <oborin.p@gmail.com>\n\n# RFC 3550\n# scapy.contrib.description = Real-Time Transport Control Protocol\n# scapy.contrib.status = loads\n\n\"\"\"\nRTCP (rfc 3550)\n\nUse bind_layers(UDP, RTCP, dport=...) to start using it\n\"\"\"\n\nimport struct\n\nfrom scapy.packet import Packet\nfrom scapy.fields import (\n    BitField,\n    BitFieldLenField,\n    ByteEnumField,\n    ByteField,\n    ConditionalField,\n    FieldLenField,\n    IntField,\n    LenField,\n    LongField,\n    PacketField,\n    PacketListField,\n    StrLenField,\n    X3BytesField,\n)\n\n\n_rtcp_packet_types = {\n    200: 'Sender report',\n    201: 'Receiver report',\n    202: 'Source description',\n    203: 'BYE',\n    204: 'APP'\n}\n\n\nclass SenderInfo(Packet):\n    name = \"Sender info\"\n    fields_desc = [\n        LongField('ntp_timestamp', None),\n        IntField('rtp_timestamp', None),\n        IntField('sender_packet_count', None),\n        IntField('sender_octet_count', None)\n    ]\n\n\nclass ReceptionReport(Packet):\n    name = \"Reception report\"\n    fields_desc = [\n        IntField('sourcesync', None),\n        ByteField('fraction_lost', None),\n        X3BytesField('cumulative_lost', None),\n        IntField('highest_seqnum_recv', None),\n        IntField('interarrival_jitter', None),\n        IntField('last_SR_timestamp', None),\n        IntField('delay_since_last_SR', None)\n    ]\n\n\n_sdes_chunk_types = {\n    0: \"END\",\n    1: \"CNAME\",\n    2: \"NAME\",\n    3: \"EMAIL\",\n    4: \"PHONE\",\n    5: \"LOC\",\n    6: \"TOOL\",\n    7: \"NOTE\",\n    8: \"PRIV\"\n}\n\n\nclass SDESItem(Packet):\n    name = \"SDES item\"\n    fields_desc = [\n        ByteEnumField('chunk_type', None, _sdes_chunk_types),\n        FieldLenField('length', None, fmt='!b', length_of='value'),\n        StrLenField('value', None, length_from=lambda pkt: pkt.length)\n    ]\n\n    def extract_padding(self, p):\n        return \"\", p\n\n\nclass SDESChunk(Packet):\n    name = \"SDES chunk\"\n    fields_desc = [\n        IntField('sourcesync', None),\n        PacketListField(\n            'items', None,\n            next_cls_cb=(\n                lambda x, y, p, z: None if (p and p.chunk_type == 0) else SDESItem\n            )\n        )\n    ]\n\n\nclass RTCP(Packet):\n    name = \"RTCP\"\n\n    fields_desc = [\n        # HEADER\n        BitField('version', 2, 2),\n        BitField('padding', 0, 1),\n        BitFieldLenField('count', 0, 5, count_of='report_blocks'),\n        ByteEnumField('packet_type', 0, _rtcp_packet_types),\n        LenField('length', None, fmt='!h'),\n        # SR/RR\n        ConditionalField(\n            IntField('sourcesync', 0),\n            lambda pkt: pkt.packet_type in (200, 201)\n        ),\n        ConditionalField(\n            PacketField('sender_info', SenderInfo(), SenderInfo),\n            lambda pkt: pkt.packet_type == 200\n        ),\n        ConditionalField(\n            PacketListField('report_blocks', None, pkt_cls=ReceptionReport,\n                            count_from=lambda pkt: pkt.count),\n            lambda pkt: pkt.packet_type in (200, 201)\n        ),\n        # SDES\n        ConditionalField(\n            PacketListField('sdes_chunks', None, pkt_cls=SDESChunk,\n                            count_from=lambda pkt: pkt.count),\n            lambda pkt: pkt.packet_type == 202\n        ),\n    ]\n\n    def post_build(self, pkt, pay):\n        pkt += pay\n        if self.length is None:\n            pkt = pkt[:2] + struct.pack(\"!h\", len(pkt) // 4 - 1) + pkt[4:]\n        return pkt\n", "path": "scapy/contrib/rtcp.py"}], "after_files": [{"content": "# SPDX-License-Identifier: GPL-2.0-only\n# This file is part of Scapy\n# See https://scapy.net/ for more information\n# Copyright (C) Pavel Oborin <oborin.p@gmail.com>\n\n# RFC 3550\n# scapy.contrib.description = Real-Time Transport Control Protocol\n# scapy.contrib.status = loads\n\n\"\"\"\nRTCP (rfc 3550)\n\nUse bind_layers(UDP, RTCP, dport=...) to start using it\n\"\"\"\n\nimport struct\n\nfrom scapy.packet import Packet\nfrom scapy.fields import (\n    BitField,\n    BitFieldLenField,\n    ByteEnumField,\n    ByteField,\n    ConditionalField,\n    FieldLenField,\n    IntField,\n    LenField,\n    LongField,\n    PacketField,\n    PacketListField,\n    StrLenField,\n    X3BytesField,\n)\n\n\n_rtcp_packet_types = {\n    200: 'Sender report',\n    201: 'Receiver report',\n    202: 'Source description',\n    203: 'BYE',\n    204: 'APP'\n}\n\n\nclass SenderInfo(Packet):\n    name = \"Sender info\"\n    fields_desc = [\n        LongField('ntp_timestamp', None),\n        IntField('rtp_timestamp', None),\n        IntField('sender_packet_count', None),\n        IntField('sender_octet_count', None)\n    ]\n\n    def extract_padding(self, p):\n        return \"\", p\n\n\nclass ReceptionReport(Packet):\n    name = \"Reception report\"\n    fields_desc = [\n        IntField('sourcesync', None),\n        ByteField('fraction_lost', None),\n        X3BytesField('cumulative_lost', None),\n        IntField('highest_seqnum_recv', None),\n        IntField('interarrival_jitter', None),\n        IntField('last_SR_timestamp', None),\n        IntField('delay_since_last_SR', None)\n    ]\n\n    def extract_padding(self, p):\n        return \"\", p\n\n\n_sdes_chunk_types = {\n    0: \"END\",\n    1: \"CNAME\",\n    2: \"NAME\",\n    3: \"EMAIL\",\n    4: \"PHONE\",\n    5: \"LOC\",\n    6: \"TOOL\",\n    7: \"NOTE\",\n    8: \"PRIV\"\n}\n\n\nclass SDESItem(Packet):\n    name = \"SDES item\"\n    fields_desc = [\n        ByteEnumField('chunk_type', None, _sdes_chunk_types),\n        FieldLenField('length', None, fmt='!b', length_of='value'),\n        StrLenField('value', None, length_from=lambda pkt: pkt.length)\n    ]\n\n    def extract_padding(self, p):\n        return \"\", p\n\n\nclass SDESChunk(Packet):\n    name = \"SDES chunk\"\n    fields_desc = [\n        IntField('sourcesync', None),\n        PacketListField(\n            'items', None,\n            next_cls_cb=(\n                lambda x, y, p, z: None if (p and p.chunk_type == 0) else SDESItem\n            )\n        )\n    ]\n\n\nclass RTCP(Packet):\n    name = \"RTCP\"\n\n    fields_desc = [\n        # HEADER\n        BitField('version', 2, 2),\n        BitField('padding', 0, 1),\n        BitFieldLenField('count', 0, 5, count_of='report_blocks'),\n        ByteEnumField('packet_type', 0, _rtcp_packet_types),\n        LenField('length', None, fmt='!h'),\n        # SR/RR\n        ConditionalField(\n            IntField('sourcesync', 0),\n            lambda pkt: pkt.packet_type in (200, 201)\n        ),\n        ConditionalField(\n            PacketField('sender_info', SenderInfo(), SenderInfo),\n            lambda pkt: pkt.packet_type == 200\n        ),\n        ConditionalField(\n            PacketListField('report_blocks', None, pkt_cls=ReceptionReport,\n                            count_from=lambda pkt: pkt.count),\n            lambda pkt: pkt.packet_type in (200, 201)\n        ),\n        # SDES\n        ConditionalField(\n            PacketListField('sdes_chunks', None, pkt_cls=SDESChunk,\n                            count_from=lambda pkt: pkt.count),\n            lambda pkt: pkt.packet_type == 202\n        ),\n    ]\n\n    def post_build(self, pkt, pay):\n        pkt += pay\n        if self.length is None:\n            pkt = pkt[:2] + struct.pack(\"!h\", len(pkt) // 4 - 1) + pkt[4:]\n        return pkt\n", "path": "scapy/contrib/rtcp.py"}]}