From 580575a51e56be6b369d8fb03f41afa3ce2a4be7 Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Fri, 7 Sep 2018 09:38:34 +0200 Subject: PER: fix dissection of enumerated type with a single extension value Per X.691 chapter 14.3, a enumerated type with extension marcker should always be encoded as a normally small non-negative whole number. Change-Id: Ice070a932792ba1654674c68157ff4b6b0942f90 Reviewed-on: https://code.wireshark.org/review/29454 Reviewed-by: Pascal Quantin Petri-Dish: Pascal Quantin Reviewed-by: Anders Broman (cherry picked from commit e4ff3e657a8abfad75041cb9e6d750ca42764af0) Reviewed-on: https://code.wireshark.org/review/29459 --- epan/dissectors/packet-per.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index d498aa29bf..8488c74812 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -1585,20 +1585,11 @@ dissect_per_enumerated(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tr offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_per_enum_index, 0, root_num - 1, &enum_index, FALSE); if (!display_internal_per_fields) PROTO_ITEM_SET_HIDDEN(actx->created_item); } else { - /* 13.3 */ - if (ext_num == 1) { - /* 10.5.4 If "range" has the value 1, - * then the result of the encoding shall be - * an empty bit-field (no bits). - */ - enum_index = 0; - } else { - /* 13.3 ".. and the value shall be added to the field-list as a - * normally small non-negative whole number whose value is the - * enumeration index of the additional enumeration and with "lb" set to 0.." - */ - offset = dissect_per_normally_small_nonnegative_whole_number(tvb, offset, actx, tree, hf_per_enum_extension_index, &enum_index); - } + /* 13.3 ".. and the value shall be added to the field-list as a + * normally small non-negative whole number whose value is the + * enumeration index of the additional enumeration and with "lb" set to 0.." + */ + offset = dissect_per_normally_small_nonnegative_whole_number(tvb, offset, actx, tree, hf_per_enum_extension_index, &enum_index); enum_index += root_num; } val = (value_map && (enum_index<(root_num+ext_num))) ? value_map[enum_index] : enum_index; -- cgit v1.2.3