In packet_list_dissect_and_cache_record(), set the columns to
*something* if we get an error reading the packet from the capture file, rather than leaving them as null (which will cause a crash). svn path=/trunk/; revision=36527
This commit is contained in:
parent
a5ddd187ca
commit
c8d2cd3cb5
|
@ -1652,6 +1652,57 @@ col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fi
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in columns if we got an error reading the packet.
|
||||
* We set most columns to "???", and set the Info column to an error
|
||||
* message.
|
||||
*/
|
||||
void
|
||||
col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!cinfo)
|
||||
return;
|
||||
|
||||
for (i = 0; i < cinfo->num_cols; i++) {
|
||||
switch (cinfo->col_fmt[i]) {
|
||||
|
||||
case COL_NUMBER:
|
||||
case COL_CLS_TIME:
|
||||
case COL_ABS_TIME:
|
||||
case COL_ABS_DATE_TIME:
|
||||
case COL_REL_TIME:
|
||||
case COL_DELTA_TIME:
|
||||
case COL_DELTA_TIME_DIS:
|
||||
case COL_PACKET_LENGTH:
|
||||
case COL_CUMULATIVE_BYTES:
|
||||
if (fill_fd_colums)
|
||||
col_fill_in_frame_data(fdata, cinfo, i, fill_col_exprs);
|
||||
break;
|
||||
|
||||
case COL_INFO:
|
||||
/* XXX - say more than this */
|
||||
cinfo->col_data[i] = "Read error";
|
||||
break;
|
||||
|
||||
case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
|
||||
g_assert_not_reached();
|
||||
break;
|
||||
default:
|
||||
if (cinfo->col_fmt[i] >= NUM_COL_FMTS) {
|
||||
g_assert_not_reached();
|
||||
}
|
||||
/*
|
||||
* No dissection was done, and these columns are set as the
|
||||
* result of the dissection, so....
|
||||
*/
|
||||
cinfo->col_data[i] = "???";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
XXX this needs more rework?
|
||||
/* --------------------------- */
|
||||
|
|
|
@ -70,6 +70,14 @@ extern void col_fill_in_frame_data(const frame_data *fd, column_info *cinfo, con
|
|||
*/
|
||||
extern void col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
|
||||
|
||||
/** Fill in columns if we got an error reading the packet.
|
||||
* We set most columns to "???", and set the Info column to an error
|
||||
* message.
|
||||
*
|
||||
* Internal, don't use this in dissectors!
|
||||
*/
|
||||
extern void col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
|
||||
|
||||
/* Utility routines used by packet*.c */
|
||||
|
||||
/** Are the columns writable?
|
||||
|
|
|
@ -87,6 +87,7 @@ col_based_on_frame_data
|
|||
col_clear
|
||||
col_custom_prime_edt
|
||||
col_fill_in
|
||||
col_fill_in_error
|
||||
col_fill_in_frame_data
|
||||
col_format_desc
|
||||
col_format_to_string
|
||||
|
|
|
@ -1125,8 +1125,33 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
|
|||
else
|
||||
cinfo = NULL;
|
||||
|
||||
if (!cf_read_frame_r(&cfile, fdata, &pseudo_header, pd))
|
||||
if (!cf_read_frame_r(&cfile, fdata, &pseudo_header, pd)) {
|
||||
/*
|
||||
* Error reading the frame.
|
||||
*
|
||||
* Don't set the color filter for now (we might want
|
||||
* to colorize it in some fashion to warn that the
|
||||
* row couldn't be filled in or colorized), and
|
||||
* set the columns to placeholder values, except
|
||||
* for the Info column, where we'll put in an
|
||||
* error message.
|
||||
*/
|
||||
if (dissect_columns) {
|
||||
col_fill_in_error(cinfo, fdata, FALSE, FALSE /* fill_fd_columns */);
|
||||
|
||||
for(col = 0; col < cinfo->num_cols; ++col) {
|
||||
/* Skip columns based on frame_data because we already store those. */
|
||||
if (!col_based_on_frame_data(cinfo, col))
|
||||
packet_list_change_record(packet_list, record->physical_pos, col, cinfo);
|
||||
}
|
||||
record->columnized = TRUE;
|
||||
}
|
||||
if (dissect_color) {
|
||||
fdata->color_filter = NULL;
|
||||
record->colorized = TRUE;
|
||||
}
|
||||
return; /* error reading the frame */
|
||||
}
|
||||
|
||||
create_proto_tree = (color_filters_used() && dissect_color) ||
|
||||
(have_custom_cols(cinfo) && dissect_columns);
|
||||
|
@ -1150,7 +1175,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
|
|||
epan_dissect_fill_in_columns(&edt, FALSE, FALSE /* fill_fd_columns */);
|
||||
|
||||
for(col = 0; col < cinfo->num_cols; ++col) {
|
||||
/* Skip columns based om frame_data because we already store those. */
|
||||
/* Skip columns based on frame_data because we already store those. */
|
||||
if (!col_based_on_frame_data(cinfo, col))
|
||||
packet_list_change_record(packet_list, record->physical_pos, col, cinfo);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue