Each MPEG2 packet contains a number of TS packets. An exception
during processing of TS packets causes processing to stop of the
remaining TS packets.

The call to call_dissector() is very likely to throw a BoundsError
as this protocol splits the media stream up into chunks of
MP2T_PACKET_SIZE.

This patch, catches BoundsError and ReportedBoundsError, to allow
processing of the remaining TS packets.

Signed-off-by: Jesper Dangaard Brouer <[email protected]>
Reviewed-by: Martin Philip Topholm <[email protected]>
---

 epan/dissectors/packet-mp2t.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)


diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c
index f3b5420..149a23e 100644
--- a/epan/dissectors/packet-mp2t.c
+++ b/epan/dissectors/packet-mp2t.c
@@ -36,6 +36,7 @@
 #include <string.h>
 
 #include <epan/rtp_pt.h>
+#include "packet-frame.h"
 
 /* The MPEG2 TS packet size */
 #define MP2T_PACKET_SIZE 188
@@ -414,7 +415,25 @@ dissect_tsp( tvbuff_t *tvb, gint offset, packet_info 
*pinfo, proto_tree *tree )
                        if (payload_len >=3 ) {
                                if (tvb_get_ntoh24(tvb, offset) == 0x000001) {
                                        tvbuff_t *next_tvb = 
tvb_new_subset(tvb, offset, payload_len, payload_len);
-                                       call_dissector(pes_handle, next_tvb, 
pinfo, mp2t_tree);
+                                       const char *saved_proto = 
pinfo->current_proto;
+
+                                       TRY {
+                                               call_dissector(pes_handle, 
next_tvb, pinfo, mp2t_tree);
+                                       }
+
+                                       /*
+                                        Don't stop processing TS packets if 
somebody threw
+                                        BoundsError, which means that 
dissecting the payload found
+                                        that the packet was cut off by before 
the end of the
+                                        payload.  This is very likely as this 
protocol splits the
+                                        media stream up into chunks of 
MP2T_PACKET_SIZE.
+                                       */
+                                       CATCH2(BoundsError, 
ReportedBoundsError) {
+                                               show_exception(next_tvb, pinfo, 
tree, EXCEPT_CODE, GET_MESSAGE);
+                                               pinfo->current_proto = 
saved_proto;
+                                       }
+
+                                       ENDTRY;
                                } else {
                                        proto_tree_add_item( mp2t_tree, 
hf_mp2t_payload, tvb, offset, payload_len, FALSE);
                                }

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe

Reply via email to