aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2013-02-01 22:44:14 +0000
committerPascal Quantin <pascal.quantin@gmail.com>2013-02-01 22:44:14 +0000
commitf26b2505953c4d4814fbaf8d6dddf12e633f5f33 (patch)
tree35bd298e4d3fe67ca665f8627a0ffb7f200a0e6f /epan
parent8984a385127683c69f43e9d5a1978b7bef7c6b87 (diff)
Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8290 :
Allow up to 64 OPTIONAL / DEFAULT components per SEQUENCE svn path=/trunk/; revision=47433
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-per.c14
-rw-r--r--epan/proto.c52
2 files changed, 62 insertions, 4 deletions
diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c
index f70c0c86f3..4f7b960373 100644
--- a/epan/dissectors/packet-per.c
+++ b/epan/dissectors/packet-per.c
@@ -1726,7 +1726,7 @@ dissect_per_sequence(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree
proto_tree *tree;
guint32 old_offset=offset;
guint32 i, num_opts;
- guint32 optional_mask;
+ guint64 optional_mask;
DEBUG_ENTRY("dissect_per_sequence");
@@ -1753,6 +1753,9 @@ DEBUG_ENTRY("dissect_per_sequence");
num_opts++;
}
}
+ if (num_opts > 64) {
+ PER_NOT_DECODED_YET("more than 64 optional/default components");
+ }
optional_mask=0;
for(i=0;i<num_opts;i++){
@@ -1778,7 +1781,7 @@ DEBUG_ENTRY("dissect_per_sequence");
if (num_opts == 0){
continue;
}
- is_present=(1<<(num_opts-1))&optional_mask;
+ is_present=(((guint64)1<<(num_opts-1))&optional_mask) ? TRUE : FALSE;
num_opts--;
if(!is_present){
continue;
@@ -1902,7 +1905,7 @@ dissect_per_sequence_eag(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_
{
gboolean optional_field_flag;
guint32 i, num_opts;
- guint32 optional_mask;
+ guint64 optional_mask;
DEBUG_ENTRY("dissect_per_sequence_eag");
@@ -1912,6 +1915,9 @@ DEBUG_ENTRY("dissect_per_sequence_eag");
num_opts++;
}
}
+ if (num_opts > 64) {
+ PER_NOT_DECODED_YET("more than 64 optional/default components");
+ }
optional_mask=0;
for(i=0;i<num_opts;i++){
@@ -1933,7 +1939,7 @@ DEBUG_ENTRY("dissect_per_sequence_eag");
if (num_opts == 0){
continue;
}
- is_present=(1<<(num_opts-1))&optional_mask;
+ is_present=(((guint64)1<<(num_opts-1))&optional_mask) ? TRUE : FALSE;
num_opts--;
if(!is_present){
continue;
diff --git a/epan/proto.c b/epan/proto.c
index 2f09322634..d6adc83c7a 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -5098,6 +5098,52 @@ tmp_fld_check_assert(header_field_info *hfinfo)
}
}
+/*static enum ftenum
+_ftype_common(enum ftenum type)
+{
+ switch (type) {
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ return FT_INT32;
+
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ case FT_IPXNET:
+ case FT_FRAMENUM:
+ return FT_UINT32;
+
+ case FT_UINT64:
+ case FT_EUI64:
+ return FT_UINT64;
+
+ case FT_STRING:
+ case FT_STRINGZ:
+ case FT_UINT_STRING:
+ return FT_STRING;
+
+ case FT_FLOAT:
+ case FT_DOUBLE:
+ return FT_DOUBLE;
+
+ case FT_BYTES:
+ case FT_UINT_BYTES:
+ case FT_ETHER:
+ case FT_OID:
+ return FT_BYTES;
+
+ case FT_ABSOLUTE_TIME:
+ case FT_RELATIVE_TIME:
+ return FT_ABSOLUTE_TIME;
+
+ default:
+ return type;
+ }
+}*/
+
#define PROTO_PRE_ALLOC_HF_FIELDS_MEM 120000
static int
proto_register_field_init(header_field_info *hfinfo, const int parent)
@@ -5175,6 +5221,12 @@ proto_register_field_init(header_field_info *hfinfo, const int parent)
same_name_hfinfo->same_name_next = hfinfo;
hfinfo->same_name_prev = same_name_hfinfo;
+
+ /*while (same_name_hfinfo) {
+ if (_ftype_common(hfinfo->type) != _ftype_common(same_name_hfinfo->type))
+ fprintf(stderr, "'%s' exists multiple times with NOT compatible types: %s and %s\n", hfinfo->abbrev, ftype_name(hfinfo->type), ftype_name(same_name_hfinfo->type));
+ same_name_hfinfo = same_name_hfinfo->same_name_prev;
+ }*/
}
}