aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtp-midi.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-03-22 00:43:12 +0000
committerEvan Huus <eapache@gmail.com>2013-03-22 00:43:12 +0000
commit80cd2ec768e92ec50d00e3a8f92e3a21da09a6d0 (patch)
tree6689d52b07da080a61af434b9aa0e7dbdcab1a05 /epan/dissectors/packet-rtp-midi.c
parentdb122cefe4d902f91c12ff05bc4c9ea8f2f1608c (diff)
Remove some sanity checks that I was able to prove wrong and/or redundant by
manual flow analysis. Fixes part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8504 General note: this dissector does *weird* things with sanity checks and manually throwing exceptions. It needs a general cleanup, but that is outside the scope of the current bug (and my available time). svn path=/trunk/; revision=48473
Diffstat (limited to 'epan/dissectors/packet-rtp-midi.c')
-rw-r--r--epan/dissectors/packet-rtp-midi.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/epan/dissectors/packet-rtp-midi.c b/epan/dissectors/packet-rtp-midi.c
index 0f70bfb20c..12e544da24 100644
--- a/epan/dissectors/packet-rtp-midi.c
+++ b/epan/dissectors/packet-rtp-midi.c
@@ -2909,7 +2909,7 @@ void proto_reg_handoff_rtp_midi( void );
* This decodes the delta-time before a MIDI-command
*/
static int
-decodetime(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int cmd_len)
+decodetime(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset)
{
guint8 octet;
unsigned int consumed;
@@ -2923,10 +2923,6 @@ decodetime(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int
/* RTP-MIDI deltatime is "compressed" using only the necessary amount of octets */
for ( i=0; i < 4; i++ ) {
- if ( !cmd_len ) {
- return -1;
- }
-
octet = tvb_get_guint8( tvb, offset + consumed );
deltatime = ( deltatime << 7 ) | ( octet & RTP_MIDI_DELTA_TIME_OCTET_MASK );
consumed++;
@@ -5574,15 +5570,8 @@ decodemidi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int
unsigned int helpoffset;
#endif
- /* extra sanity check */
- if ( !cmd_len ) {
- return -1;
- }
-
-
octet = tvb_get_guint8( tvb, offset );
-
/* midi realtime-data -> one octet -- unlike serial-wired MIDI realtime-commands in RTP-MIDI will
* not be intermingled with other MIDI-commands, so we handle this case right here and return */
if ( octet >= 0xf8 ) {
@@ -7096,11 +7085,6 @@ decode_system_journal( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
}
- /* Make sanity check for consumed data vs. stated length of system journal */
- if ( consumed <= sysjourlen ) {
- return -1;
- }
-
/* Do we have a Sysex chapter? */
if ( systemflags & RTP_MIDI_SJ_FLAG_X ) {
ext_consumed = decode_sj_chapter_x( tvb, pinfo, rtp_midi_sj_chapters_tree, offset, sysjourlen - consumed );
@@ -7203,12 +7187,8 @@ dissect_rtp_midi( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree )
/* for the first command we only have a delta-time if Z-Flag is set */
if ( ( cmd_count ) || ( flags & RTP_MIDI_CS_FLAG_Z ) ) {
- /* Decode a delta-time - if 0 is returned something went wrong */
- consumed = decodetime( tvb, pinfo, rtp_midi_commands_tree, offset, cmd_len );
- if ( -1 == consumed ) {
- THROW( ReportedBoundsError );
- return;
- }
+ /* Decode a delta-time */
+ consumed = decodetime( tvb, pinfo, rtp_midi_commands_tree, offset );
/* seek to next command and set remaining length */
offset += consumed;