Ethereal-dev: [Ethereal-dev] [PATCH] [Debian bug#244743] segfault when computing "Protocol Hie

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jon Oberheide <jon@xxxxxxxxxxxxx>
Date: Thu, 22 Apr 2004 18:01:34 -0400
Peter and others,

Here's a debug output of the proto_tree when statistics are attempted to
be generated for the second packet in the attached capture:

name: Frame  field id:  4568  parent:  -1
name: Ethernet  field id:  3309  parent:  -1
name: Internet Protocol  field id:  6781  parent:  -1
name: Transmission Control Protocol  field id:  15674  parent:  -1
name: Novell Distributed Print System  field id:  11235  parent:  -1
name: Unreassembled Fragmented Packet  field id:  4581  parent:  -1
name: Frame  field id:  4568  parent:  -1
name: Ethernet  field id:  3309  parent:  -1
name: Internet Protocol  field id:  6781  parent:  -1
name: Transmission Control Protocol  field id:  15674  parent:  -1
name: This is a continuation to the PDU in frame  field id:  15705
parent:  15674

It's obvious here why the assertion is failing:  15674 != -1

Since hf_tcp_continuation_to (field id: 15705) is a child of TCP
(15674), it belongs under the tcp_tree.  The attached patch resolves
this bug and allows the hierarchical statistics to be generated.  I've
also attached the capture that causes the crash for reference.

Regards,
Jon Oberheide
jon@xxxxxxxxxxxxx


On Thu, 2004-04-22 at 14:37, fpeters@xxxxxxxxxx wrote:
> Hello,
> 
> Reported by Chris Leigh as:
>   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=244743
> 
> 
> ** ERROR **: file proto_hier_stats.c: line 98 (process_node): assertion failed: (finfo->hfinfo->parent == -1)
> aborting...
> 
> Attached is a reduced capture file to reproduce the problem.
> 
> 
> Regards,
> 
>         Frederic
> 
> 
> ______________________________________________________________________
> _______________________________________________
> Ethereal-dev mailing list
> Ethereal-dev@xxxxxxxxxxxx
> http://www.ethereal.com/mailman/listinfo/ethereal-dev

Attachment: proto_hier_stats-crash
Description: Binary data

--- ethereal.old/packet-tcp.c	2004-04-13 20:16:28.000000000 -0400
+++ ethereal.cvs/packet-tcp.c	2004-04-22 17:38:00.580029664 -0400
@@ -380,7 +380,7 @@
    and let TCP try to find out what it can about this segment
 */
 static int
-scan_for_next_pdu(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, guint32 seq, guint32 nxtseq)
+scan_for_next_pdu(tvbuff_t *tvb, proto_tree *tcp_tree, packet_info *pinfo, int offset, guint32 seq, guint32 nxtseq)
 {
 	struct tcp_analysis *tcpd=NULL;
 	struct tcp_next_pdu *tnp=NULL;
@@ -415,7 +415,7 @@
 				if (check_col(pinfo->cinfo, COL_INFO)){
 					col_prepend_fstr(pinfo->cinfo, COL_INFO, "[Continuation to #%u] ",pinfo->fd->num);
 				}
-				proto_tree_add_uint(tree, hf_tcp_continuation_to,
+				proto_tree_add_uint(tcp_tree, hf_tcp_continuation_to,
 					tvb, 0, 0, pinfo->fd->num);
 				return -1;
 			}			
@@ -436,7 +436,7 @@
 			if (check_col(pinfo->cinfo, COL_INFO)){
 				col_prepend_fstr(pinfo->cinfo, COL_INFO, "[Continuation to #%u] ", first_frame);
 			}
-			proto_tree_add_uint(tree, hf_tcp_continuation_to,
+			proto_tree_add_uint(tcp_tree, hf_tcp_continuation_to,
 				tvb, 0, 0, first_frame);
 			return -1;
 		}
@@ -2396,7 +2396,7 @@
 			/*qqq   see if it is an unaligned PDU */
 			if(tcp_analyze_seq && (!tcp_desegment)){
 				if(seq || nxtseq){
-					offset=scan_for_next_pdu(tvb, tree, pinfo, offset,
+					offset=scan_for_next_pdu(tvb, tcp_tree, pinfo, offset,
 						seq, nxtseq);
 				}
 			}