I'm trying to get up to speed with tvbuffs having done very little development
work for about 4 weeks, and I have just got my source tree to compile. I have
been testing it with a rather large (9MByte) capture file.
I was able to get ethereal to dump core with a segmentation fault, I think
at the last line shown below:
/* Allocate the next list entry, and add it to the list. */
fdata = g_mem_chunk_alloc(cf->plist_chunk);
fdata->next = NULL;
I think that glib posted a warning the parameter passed
to g_mem_chunk_alloc() was NULL & I am working on the basis that
the problem occurred when attempting to de-reference through the null
pointer fdata to get the location fdata->next.
This analysis depends on the truth of my belief that g_mem_chunk_alloc()
returns and returns a NULL value when given invalid data.
I have been able to confirm that cf->plist_chunk was 0x0.
There seem to be several things that may need doing.
1) The assignment to fdata->next should be protected by
an assertion that fdata is not NULL.
g_assert( fdata );
2) The return value of g_mem_chunk_alloc() should be checked
/* Allocate the next list entry, and add it to the list. */
fdata = g_mem_chunk_alloc(cf->plist_chunk);
if( fdata ) {
fdata->next = NULL;
/* .... */
} else {
/* g_mem_chunk_alloc() returned with an error */
/* handle the error */
};
3) There should be an assertion at the top of wtap_dispatch_cb()
that cf->plist_chunk is not NULL.
g_assert( cf->plist_chunk );
Do you agree? If so would you like a patch?
Ben.
--
Leedsnet - The information resource for Leeds and the West Riding
< URL:http://www.leedsnet.com/mobile/ >