aboutsummaryrefslogtreecommitdiffstats
path: root/cfile.h
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-06-27 17:28:06 -0700
committerAnders Broman <a.broman58@gmail.com>2018-06-28 21:14:01 +0000
commit8e07b778f6a79b17e905f52e5e0e8c9187c091bd (patch)
treea79a1dafe095ec517a08e3957a38a9cde2080502 /cfile.h
parent411c5e9dcfa78d5eeadcdc357cb99ffb7b423ce2 (diff)
file: do not perform recursive redissections to avoid crashes
When packets are being read (in "cf_read") or rescanned/redissected (in "rescan_packets"), it could call "update_progress_dlg". That could end up accepting GUI actions such as changing profiles (which triggers a redissection via "cf_redissect_packets") or changing the display filter (which triggers another "rescan_packets" via "cf_filter_packets"). Such recursive calls waste CPU and in case of "cf_redissect_packets" it also causes memory corruption (since "cf->epan" is destroyed while "cf_read" tries to read and process packets). Fix this by delaying the rescan/redissection when an existing rescan is pending. Abort an existing rescan/redissection if a new redissection (due to profile changes) or rescan (due to display filter changes) is requested and restart this to ensure that the intended user action is applied (such as a new display filter). Bug: 14918 Change-Id: I646730f639b20aa9ec35306e3f11bf22f5923786 Reviewed-on: https://code.wireshark.org/review/28500 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'cfile.h')
-rw-r--r--cfile.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/cfile.h b/cfile.h
index ad3a7ead3c..01f430b028 100644
--- a/cfile.h
+++ b/cfile.h
@@ -30,6 +30,13 @@ typedef enum {
FILE_READ_DONE /* Read completed */
} file_state;
+/* Requested packets rescan action. */
+typedef enum {
+ RESCAN_NONE = 0, /* No rescan requested */
+ RESCAN_SCAN, /* Request rescan without full redissection. */
+ RESCAN_REDISSECT /* Request full redissection. */
+} rescan_type;
+
/* Character set for text search. */
typedef enum {
SCS_NARROW_AND_WIDE,
@@ -84,6 +91,7 @@ typedef struct _capture_file {
dfilter_t *dfcode; /* Compiled display filter program */
gchar *dfilter; /* Display filter string */
gboolean redissecting; /* TRUE if currently redissecting (cf_redissect_packets) */
+ rescan_type redissection_queued; /* Queued redissection type. */
/* search */
gchar *sfilter; /* Filter, hex value, or string being searched */
gboolean hex; /* TRUE if "Hex value" search was last selected */