aboutsummaryrefslogtreecommitdiffstats
path: root/file.h
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-04-06 18:42:39 +0100
committerGuy Harris <guy@alum.mit.edu>2019-04-06 20:00:57 +0000
commitf0a2b8303a9fcd18d09e27d79bd21ac19d9da7d0 (patch)
tree62eac2ad5fb725ca6128acfdd2cf33fadb17a54e /file.h
parent3ba1c7ff7749a6c55a0e6155fd5c4fef6ca8644d (diff)
Revert "Get rid of the per-capture_file wtap_rec and Buffer."
This reverts commit 9445403f9558901dc54c88754ff21795ea1803f3. cf_select_packet frees the buffer backing the dissection result (cf->edt) which results in use-after-frees when callers try to access the contents. See for example this call trace: * PacketList::selectionChanged * cf_select_packet(cap_file_, row) * frameSelected(row) -> ByteViewTab::selectedFrameChanged * addTab(source_name, get_data_source_tvb(source)) get_data_source_tvb returns the buffer that backs the dissection and must remain valid even after dissection has completed. If this is not done, then a possibly expensive redissection must be done in order to populate the byte view. The temporary memory savings are not worth it. Bug: 15683 Change-Id: Ia5ec2c7736cdebbac3c5bf46a4e2470c9236262d Reviewed-on: https://code.wireshark.org/review/32758 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'file.h')
-rw-r--r--file.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/file.h b/file.h
index 18e537f151..0d9bcb318e 100644
--- a/file.h
+++ b/file.h
@@ -150,8 +150,19 @@ cf_read_status_t cf_read(capture_file *cf, gboolean from_save);
* @param buf a Buffer into which to read the record's raw data
* @return TRUE if the read succeeded, FALSE if there was an error
*/
-gboolean cf_read_record(capture_file *cf, const frame_data *fdata,
- wtap_rec *rec, Buffer *buf);
+gboolean cf_read_record_r(capture_file *cf, const frame_data *fdata,
+ wtap_rec *rec, Buffer *buf);
+
+/**
+ * Read the metadata and raw data for a record into a
+ * capture_file structure's phdr and buf members.
+ * It will pop up an alert box if there's an error.
+ *
+ * @param cf the capture file from which to read the record
+ * @param fdata the frame_data structure for the record in question
+ * @return TRUE if the read succeeded, FALSE if there was an error
+ */
+gboolean cf_read_record(capture_file *cf, frame_data *fdata);
/**
* Read packets from the "end" of a capture file.