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 <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2018-09-29 19:05:45 +02:00 committed by Anders Broman
parent e885798f22
commit 29fbbfb3d3
1 changed files with 2 additions and 0 deletions

View File

@ -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);
}
}