aboutsummaryrefslogtreecommitdiffstats
path: root/epan/column-utils.c
diff options
context:
space:
mode:
authorOke Hargens <oke.hargens@cetitec.com>2022-01-07 15:37:45 +0100
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-03-04 12:03:36 +0000
commitf461e33a41c0af201188b5130b7d0ec2b131dd60 (patch)
tree252714bfe510312b26ce41dcf95b9f2cc225650e /epan/column-utils.c
parent0d0c1ceead7005eef3b4cf6a4ad645a29aaba2a2 (diff)
column-utils: Add missing check for frame_data::has_ts
Adds check for frame_data::has_ts in col_set_delta_time before calling set_time_seconds. This is the same check that is done in multiple other methods in column-utils.c. Because frame_data::tsprec might not be initialized if has_ts is false, this resulted in a failed assertion in set_time_seconds if the user created a column with "Delta time". Also adds an assertion for frame_data::has_ts in set_time_seconds.
Diffstat (limited to 'epan/column-utils.c')
-rw-r--r--epan/column-utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 6f00d1da67..e80558ded7 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -1141,6 +1141,8 @@ set_time_seconds(const frame_data *fd, const nstime_t *ts, gchar *buf)
{
int tsprecision;
+ ws_assert(fd->has_ts);
+
switch (timestamp_get_precision()) {
case TS_PREC_FIXED_SEC:
tsprecision = WTAP_TSPREC_SEC;
@@ -1204,6 +1206,8 @@ set_time_hour_min_sec(const frame_data *fd, const nstime_t *ts, gchar *buf, char
gboolean negative = FALSE;
int tsprecision;
+ ws_assert(fd->has_ts);
+
if (secs < 0) {
secs = -secs;
negative = TRUE;
@@ -1416,6 +1420,11 @@ col_set_delta_time(const frame_data *fd, column_info *cinfo, const int col)
{
nstime_t del_cap_ts;
+ if (!fd->has_ts) {
+ cinfo->columns[col].col_buf[0] = '\0';
+ return;
+ }
+
frame_delta_abs_time(cinfo->epan, fd, fd->num - 1, &del_cap_ts);
switch (timestamp_get_seconds_type()) {