From 29fbbfb3d39e801280d21e608bc269af4c1cd0cd Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 29 Sep 2018 19:05:45 +0200 Subject: [PATCH] Qt/ByteViewTab: document potential pitfall If ByteViewTab is related to a use-after-free crash, then the issue is probably related to the backing buffer becoming invalid. Document this. Change-Id: I7f7c8daaf86b42f00b7886de54507d425e5312f6 Reviewed-on: https://code.wireshark.org/review/29924 Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/qt/byte_view_tab.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/qt/byte_view_tab.cpp b/ui/qt/byte_view_tab.cpp index eff04661fa..533e128118 100644 --- a/ui/qt/byte_view_tab.cpp +++ b/ui/qt/byte_view_tab.cpp @@ -96,6 +96,8 @@ void ByteViewTab::addTab(const char *name, tvbuff_t *tvb) { if ( tvb ) { int data_len = (int) tvb_captured_length(tvb); if (data_len > 0) { + // Note: this does not copy the data and will be invalidated when + // the tvb becomes invalid (e.g. when the current packet changes). data = QByteArray::fromRawData((const char *) tvb_get_ptr(tvb, 0, data_len), data_len); } }