diff options
author | Evan Huus <eapache@gmail.com> | 2013-03-22 00:27:29 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-03-22 00:27:29 +0000 |
commit | db122cefe4d902f91c12ff05bc4c9ea8f2f1608c (patch) | |
tree | ac5349c082c7038d53b121fc5a9086a8d2ae185d /epan/dissectors/packet-rtp-midi.c | |
parent | fc6fde93b4662865cbfa24fdaa2fcd430a44e25e (diff) |
Remove 55(!) thoroughly unnecessary tvb_bytes_exist calls from RTP-MIDI
dissector. Discovered while poking around in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8504
svn path=/trunk/; revision=48472
Diffstat (limited to 'epan/dissectors/packet-rtp-midi.c')
-rw-r--r-- | epan/dissectors/packet-rtp-midi.c | 241 |
1 files changed, 0 insertions, 241 deletions
diff --git a/epan/dissectors/packet-rtp-midi.c b/epan/dissectors/packet-rtp-midi.c index 4533b25050..0f70bfb20c 100644 --- a/epan/dissectors/packet-rtp-midi.c +++ b/epan/dissectors/packet-rtp-midi.c @@ -5723,11 +5723,6 @@ decode_cj_chapter_c( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un int count; int i; - /* Can we at least read the length of the control changes chapter? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - octet = tvb_get_guint8( tvb, offset ); count = octet & 0x7f; @@ -5747,10 +5742,6 @@ decode_cj_chapter_c( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_c_loglist ); for ( i = 0; i < count; i++ ) { - /* Can we still read this number/value-pair? */ - if ( !tvb_bytes_exist( tvb, offset, 2 ) ) { - return -1; - } ti = proto_tree_add_text(rtp_midi_loglist_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_C_LOGITEM ); ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_c_logitem ); @@ -5797,11 +5788,6 @@ decode_cj_chapter_m( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un gboolean no_pnum_msb; int consumed = 0; - /* Can we read this channel-journals header? */ - if ( !tvb_bytes_exist( tvb, offset, 2 ) ) { - return -1; - } - /* first we need to get the flags & length of this chapter */ header = tvb_get_ntohs( tvb, offset ); length = header & RTP_MIDI_CJ_CHAPTER_M_MASK_LENGTH; @@ -5825,10 +5811,6 @@ decode_cj_chapter_m( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un /* do we have the pending field? */ if ( header & 0x4000 ) { - /* Can we read this pending field? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_qflag, tvb, offset, 1, ENC_BIG_ENDIAN ); proto_tree_add_item( rtp_midi_cj_chapter_tree, hf_rtp_midi_cj_chapter_m_pending, tvb, offset, 1, ENC_BIG_ENDIAN ); @@ -5850,11 +5832,6 @@ decode_cj_chapter_m( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un /* lets step through the loglist */ while ( length > 0 ) { - /* Can we read this channel-journals header? */ - if ( !tvb_bytes_exist( tvb, offset, logitemhdrlen ) ) { - return -1; - } - if ( no_pnum_msb ) { logitemheader = tvb_get_guint8( tvb, offset + 1 ); } else { @@ -5922,11 +5899,6 @@ decode_cj_chapter_m( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un /* do we have a entry-msb field? */ if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_J ) { - /* Can we read this table? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_MSB ); ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_msb ); @@ -5940,10 +5912,6 @@ decode_cj_chapter_m( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un /* do we have a entry-lsb field? */ if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_K ) { - /* Can we read this table? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_LSB ); ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_lsb ); @@ -5958,10 +5926,6 @@ decode_cj_chapter_m( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un /* do we have an a-button field? */ if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_L ) { - /* Can we read this table? */ - if ( !tvb_bytes_exist( tvb, offset, 2 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_A_BUTTON ); ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_a_button ); @@ -5977,10 +5941,6 @@ decode_cj_chapter_m( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un /* do we have a c-button field? */ if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_M ) { - /* Can we read this table? */ - if ( !tvb_bytes_exist( tvb, offset, 2 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_C_BUTTON ); ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_c_button ); @@ -5995,10 +5955,6 @@ decode_cj_chapter_m( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un /* do we have a count field? */ if ( logitemheader & RTP_MIDI_CJ_CHAPTER_M_FLAG_N ) { - /* Can we read this table? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_loglist_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_M_LOG_COUNT ); ti = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_m_log_count ); @@ -6036,11 +5992,6 @@ decode_cj_chapter_n( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un int high; int i; - /* Can we read this channel-journals header? */ - if ( !tvb_bytes_exist( tvb, offset, 2 ) ) { - return -1; - } - /* first we need to get the flags & length of this chapter */ header = tvb_get_ntohs( tvb, offset ); log_count = ( header & RTP_MIDI_CJ_CHAPTER_N_MASK_LENGTH ) >> 8; @@ -6076,11 +6027,6 @@ decode_cj_chapter_n( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un if ( log_count > 0 ) { - /* Can we read this loglist? */ - if ( !tvb_bytes_exist( tvb, offset, log_count * 2 ) ) { - return -1; - } - ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_N_LOGLIST ); rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_n_loglist ); @@ -6111,10 +6057,6 @@ decode_cj_chapter_n( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un if ( octet_count > 0 ) { - /* Can we read this loglist? */ - if ( !tvb_bytes_exist( tvb, offset, octet_count ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count, RTP_MIDI_TREE_NAME_CJ_CHAPTER_N_OCTETS ); rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_n_octets ); @@ -6148,11 +6090,6 @@ decode_cj_chapter_e( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un int log_count; int i; - /* Can we read this channel-journals header? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - /* first we need to get the flags & length of this chapter */ header = tvb_get_guint8( tvb, offset ); log_count = header & RTP_MIDI_CJ_CHAPTER_E_MASK_LENGTH; @@ -6169,11 +6106,6 @@ decode_cj_chapter_e( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un offset++; consumed++; - /* Can we read this loglist? */ - if ( !tvb_bytes_exist( tvb, offset, log_count * 2 ) ) { - return -1; - } - ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_E_LOGLIST ); rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_e_loglist ); @@ -6235,11 +6167,6 @@ decode_cj_chapter_a( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un int log_count; int i; - /* Can we read this channel-journals header? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - /* first we need to get the flags & length of this chapter */ header = tvb_get_guint8( tvb, offset ); log_count = header & RTP_MIDI_CJ_CHAPTER_A_MASK_LENGTH; @@ -6256,11 +6183,6 @@ decode_cj_chapter_a( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un offset++; consumed++; - /* Can we read this loglist? */ - if ( !tvb_bytes_exist( tvb, offset, log_count * 2 ) ) { - return -1; - } - ti = proto_tree_add_text( rtp_midi_cj_chapter_tree, tvb, offset, log_count * 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_A_LOGLIST ); rtp_midi_loglist_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_a_loglist ); @@ -6308,11 +6230,6 @@ decode_channel_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int consumed = 0; int ext_consumed = 0; - /* Can we read this channel-journals header? */ - if ( !tvb_bytes_exist( tvb, offset, 3 ) ) { - return -1; - } - /* first we need to get the flags & length of this channel-journal */ chanflags = tvb_get_ntoh24( tvb, offset ); chanjourlen = ( chanflags & RTP_MIDI_CJ_MASK_LENGTH ) >> 8; @@ -6343,11 +6260,6 @@ decode_channel_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* Do we have a program change chapter? */ if ( chanflags & RTP_MIDI_CJ_FLAG_P ) { - /* Can we read the program change chapter? */ - if ( !tvb_bytes_exist( tvb, offset, 3 ) ) { - return -1; - } - ti = proto_tree_add_text( rtp_midi_cj_chapters_tree, tvb, offset, 3, RTP_MIDI_TREE_NAME_CJ_CHAPTER_P ); rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_p ); @@ -6386,11 +6298,6 @@ decode_channel_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* Do we have a pitch-wheel chapter? */ if ( chanflags & RTP_MIDI_CJ_FLAG_W ) { - /* Can we get the data for the Pitch Wheel chapter? */ - if ( !tvb_bytes_exist( tvb, offset, 2 ) ) { - return -1; - } - ti = proto_tree_add_text( rtp_midi_cj_chapters_tree, tvb, offset, 2, RTP_MIDI_TREE_NAME_CJ_CHAPTER_W ); rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_w ); @@ -6429,10 +6336,6 @@ decode_channel_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* Do we have channel aftertouch chapter? */ if ( chanflags & RTP_MIDI_CJ_FLAG_T ) { - /* Can we get the data for the Pitch Wheel chapter? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_cj_chapters_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_CJ_CHAPTER_T ); rtp_midi_cj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_cj_chapter_t ); @@ -6473,11 +6376,6 @@ decode_sj_chapter_d_f4( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint16 f4flags; guint16 f4length; - /* Can we read this fields header? */ - if ( !tvb_bytes_exist( tvb, offset, 2 ) ) { - return -1; - } - /* Get flags & length */ f4flags = tvb_get_ntohs( tvb, offset ); f4length = f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_LENGTH; @@ -6499,10 +6397,6 @@ decode_sj_chapter_d_f4( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if ( f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_C ) { - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_count, tvb, offset, 1, ENC_BIG_ENDIAN ); offset++; @@ -6517,9 +6411,6 @@ decode_sj_chapter_d_f4( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* variable length field - ends with an octet with MSB set */ for (;;) { - if ( !tvb_bytes_exist( tvb, offset+valuelen, 1 ) ) { - return -1; - } octet = tvb_get_guint8( tvb, offset+valuelen ); valuelen++; if ( octet & 0x80 ) { @@ -6533,10 +6424,6 @@ decode_sj_chapter_d_f4( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if ( f4flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_L ) { - if ( !tvb_bytes_exist( tvb, offset, f4length ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_legal, tvb, offset, f4length, ENC_NA ); offset += f4length; f4length -= f4length; @@ -6545,10 +6432,6 @@ decode_sj_chapter_d_f4( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* if we still have data, the length-field was incorrect we dump the data here and abort! */ if ( f4length > 0 ) { - if ( !tvb_bytes_exist( tvb, offset, f4length ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_data, tvb, offset, f4length, ENC_NA ); consumed += f4length; /* must be a protocol error - since we have a length, we can recover...*/ @@ -6571,11 +6454,6 @@ decode_sj_chapter_d_f5( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint16 f5flags; guint16 f5length; - /* Can we read this fields header? */ - if ( !tvb_bytes_exist( tvb, offset, 2 ) ) { - return -1; - } - /* Get flags & length */ f5flags = tvb_get_ntohs( tvb, offset ); f5length = f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_MASK_LENGTH; @@ -6597,10 +6475,6 @@ decode_sj_chapter_d_f5( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if ( f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_C ) { - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_count, tvb, offset, 1, ENC_BIG_ENDIAN ); offset++; @@ -6615,9 +6489,6 @@ decode_sj_chapter_d_f5( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* variable length field - ends with an octet with MSB set */ for (;;) { - if ( !tvb_bytes_exist( tvb, offset+valuelen, 1 ) ) { - return -1; - } octet = tvb_get_guint8( tvb, offset+valuelen ); valuelen++; if ( octet & 0x80 ) { @@ -6631,10 +6502,6 @@ decode_sj_chapter_d_f5( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if ( f5flags & RTP_MIDI_SJ_CHAPTER_D_SYSCOM_FLAG_L ) { - if ( !tvb_bytes_exist( tvb, offset, f5length ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_legal, tvb, offset, f5length, ENC_NA ); offset += f5length; f5length -= f5length; @@ -6643,10 +6510,6 @@ decode_sj_chapter_d_f5( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* if we still have data, we dump it here - see above! */ if ( f5length > 0 ) { - if ( !tvb_bytes_exist( tvb, offset, f5length ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_syscom_data, tvb, offset, f5length, ENC_NA ); consumed += f5length; /* must be a protocol error - since we have a length, we can recover...*/ @@ -6667,11 +6530,6 @@ decode_sj_chapter_d_f9( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint8 f9flags; guint8 f9length; - /* Can we read this fields header? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - /* Get flags & length */ f9flags = tvb_get_guint8( tvb, offset ); f9length = f9flags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_LENGTH; @@ -6691,10 +6549,6 @@ decode_sj_chapter_d_f9( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if ( f9flags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_C ) { - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_count, tvb, offset, 1, ENC_BIG_ENDIAN ); offset++; @@ -6704,10 +6558,6 @@ decode_sj_chapter_d_f9( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if ( f9flags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_L ) { - if ( !tvb_bytes_exist( tvb, offset, f9length ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_legal, tvb, offset, f9length, ENC_NA ); offset += f9length; f9length -= f9length; @@ -6717,10 +6567,6 @@ decode_sj_chapter_d_f9( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if ( f9length > 0 ) { - if ( !tvb_bytes_exist( tvb, offset, f9length ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_data, tvb, offset, f9length, ENC_NA ); consumed += f9length; /* must be a protocol error - since we have a length, we can recover...*/ @@ -6742,11 +6588,6 @@ decode_sj_chapter_d_fd( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint8 fdflags; guint8 fdlength; - /* Can we read this fields header? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - /* Get flags & length */ fdflags = tvb_get_guint8( tvb, offset ); fdlength = fdflags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_MASK_LENGTH; @@ -6766,10 +6607,6 @@ decode_sj_chapter_d_fd( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if ( fdflags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_C ) { - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_count, tvb, offset, 1, ENC_BIG_ENDIAN ); offset++; @@ -6779,10 +6616,6 @@ decode_sj_chapter_d_fd( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if ( fdflags & RTP_MIDI_SJ_CHAPTER_D_SYSREAL_FLAG_L ) { - if ( !tvb_bytes_exist( tvb, offset, fdlength ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_legal, tvb, offset, fdlength, ENC_NA ); offset += fdlength; fdlength -= fdlength; @@ -6792,10 +6625,6 @@ decode_sj_chapter_d_fd( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if ( fdlength > 0 ) { - if ( !tvb_bytes_exist( tvb, offset, fdlength ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_field_tree, hf_rtp_midi_sj_chapter_d_sysreal_data, tvb, offset, fdlength, ENC_NA ); consumed += fdlength; @@ -6820,11 +6649,6 @@ decode_sj_chapter_d( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un int consumed = 0; int ext_consumed; - /* Can we read this channel-journals header? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - /* first we need to get the flags of this chapter */ header = tvb_get_guint8( tvb, offset ); @@ -6850,10 +6674,6 @@ decode_sj_chapter_d( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un /* do we have Reset field? */ if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_B ) { - /* Can we get the data for the Reset chapter? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_B ); rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_b ); @@ -6867,10 +6687,6 @@ decode_sj_chapter_d( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un /* do we have Tune request field? */ if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_G ) { - /* Can we get the data for the Reset chapter? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_G ); rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_g ); @@ -6884,10 +6700,6 @@ decode_sj_chapter_d( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un /* do we have Song select field? */ if ( header & RTP_MIDI_SJ_CHAPTER_D_FLAG_H ) { - /* Can we get the data for the Reset chapter? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_D_FIELD_H ); rtp_midi_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_d_field_h ); @@ -6955,11 +6767,6 @@ decode_sj_chapter_q( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un int consumed = 0; int len = 1; - /* Can we read this chapters header? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - /* first we need to get the flags of this chapter */ header = tvb_get_guint8( tvb, offset ); @@ -6982,10 +6789,6 @@ decode_sj_chapter_q( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un if ( header & RTP_MIDI_SJ_CHAPTER_Q_FLAG_C ) { - if ( !tvb_bytes_exist( tvb, offset, 3 ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_clock, tvb, offset, 3, ENC_BIG_ENDIAN ); consumed += 3; @@ -6999,9 +6802,6 @@ decode_sj_chapter_q( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un } if ( header & RTP_MIDI_SJ_CHAPTER_Q_FLAG_T ) { - if ( !tvb_bytes_exist( tvb, offset, 3 ) ) { - return -1; - } proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_q_timetools, tvb, offset, 3, ENC_BIG_ENDIAN ); @@ -7023,11 +6823,6 @@ decode_sj_chapter_f( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un int consumed = 0; int len = 1; - /* Can we read this chapters header? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - /* first we need to get the flags of this chapter */ header = tvb_get_guint8( tvb, offset ); @@ -7053,9 +6848,6 @@ decode_sj_chapter_f( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un offset++; if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_C ) { - if ( !tvb_bytes_exist( tvb, offset, 4 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 4, RTP_MIDI_TREE_NAME_SJ_CHAPTER_F_COMPLETE ); rtp_midi_sj_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_f_complete ); @@ -7082,9 +6874,6 @@ decode_sj_chapter_f( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un } if ( header & RTP_MIDI_SJ_CHAPTER_F_FLAG_P ) { - if ( !tvb_bytes_exist( tvb, offset, 4 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_sj_chapter_tree, tvb, offset, 4, RTP_MIDI_TREE_NAME_SJ_CHAPTER_F_PARTIAL ); rtp_midi_sj_field_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_f_partial ); @@ -7118,11 +6907,6 @@ decode_sj_chapter_x( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un unsigned int cmdlen = 0; unsigned int i; - /* Can we read this chapter's header? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - /* first we need to get the flags of this chapter */ header = tvb_get_guint8( tvb, offset ); @@ -7142,10 +6926,6 @@ decode_sj_chapter_x( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_T ) { - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_tcount, tvb, offset, 1, ENC_BIG_ENDIAN ); consumed++; @@ -7154,10 +6934,6 @@ decode_sj_chapter_x( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_C ) { - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } - proto_tree_add_item( rtp_midi_sj_chapter_tree, hf_rtp_midi_sj_chapter_x_count, tvb, offset, 1, ENC_BIG_ENDIAN ); consumed++; @@ -7255,13 +7031,6 @@ decode_system_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint16 sysjourlen; guint16 systemflags; - - - /* Can we read this channel-journals header? */ - if ( !tvb_bytes_exist( tvb, offset, 2 ) ) { - return -1; - } - systemflags = tvb_get_ntohs( tvb, offset ); sysjourlen = systemflags & RTP_MIDI_SJ_MASK_LENGTH; @@ -7295,10 +7064,6 @@ decode_system_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* Do we have a active sensing chapter? */ if ( systemflags & RTP_MIDI_SJ_FLAG_V ) { proto_tree *rtp_midi_sj_chapter_tree; - /* Can we get the data for the Active Sense chapter? */ - if ( !tvb_bytes_exist( tvb, offset, 1 ) ) { - return -1; - } ti = proto_tree_add_text( rtp_midi_sj_chapters_tree, tvb, offset, 1, RTP_MIDI_TREE_NAME_SJ_CHAPTER_V ); rtp_midi_sj_chapter_tree = proto_item_add_subtree( ti, ett_rtp_midi_sj_chapter_v ); @@ -7426,12 +7191,6 @@ dissect_rtp_midi( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree ) command_item = proto_tree_add_text( rtp_midi_tree, tvb, offset, cmd_len, RTP_MIDI_TREE_NAME_COMMAND ); rtp_midi_commands_tree = proto_item_add_subtree( command_item, ett_rtp_midi_commands ); - /* if the reported command-length larger than data found in packet -> error */ - if ( !tvb_bytes_exist( tvb, offset, cmd_len ) ) { - THROW( ReportedBoundsError ); - return; - } - /* No commands decoded yet */ cmd_count = 0; |