aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-12-15 13:40:34 -0800
committerAnders Broman <a.broman58@gmail.com>2017-12-18 04:28:06 +0000
commit3c87991c28dda0ee2e64c73e3df6c671a19ab42c (patch)
tree56487905018ee9e3510382acb3eb6f6e74fbba8f
parent67a49eb2ece34494a0fe1efd76d36c9b4d46d11e (diff)
-1 is a valid tree_type value.
Adjust tree_expanded and FieldInformation::treeType accordingly. Change-Id: I9b12c28550ba2639f636531a7ea1841df0638b5e Reviewed-on: https://code.wireshark.org/review/24844 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/proto.c17
-rw-r--r--ui/qt/utils/field_information.cpp2
2 files changed, 5 insertions, 14 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 806d6f9..e3864f7 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -5,19 +5,7 @@
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * SPDX-License-Identifier: GPL-2.0+
*/
#include "config.h"
@@ -11801,6 +11789,9 @@ proto_check_field_name(const gchar *field_name)
gboolean
tree_expanded(int tree_type)
{
+ if (tree_type == -1) {
+ return FALSE;
+ }
g_assert(tree_type >= 0 && tree_type < num_tree_types);
return tree_is_expanded[tree_type >> 5] & (1U << (tree_type & 31));
}
diff --git a/ui/qt/utils/field_information.cpp b/ui/qt/utils/field_information.cpp
index 9b421341..06850bd 100644
--- a/ui/qt/utils/field_information.cpp
+++ b/ui/qt/utils/field_information.cpp
@@ -52,7 +52,7 @@ void FieldInformation::setParentField(field_info * par_fi)
int FieldInformation::treeType()
{
if (fi_) {
- Q_ASSERT(fi_->tree_type >= 0 && fi_->tree_type < num_tree_types);
+ Q_ASSERT(fi_->tree_type >= -1 && fi_->tree_type < num_tree_types);
return fi_->tree_type;
}
return -1;