forked from osmocom/wireshark
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 <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
4ff777d5ce
commit
e4ff3e657a
|
@ -1623,20 +1623,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;
|
||||
|
|
Loading…
Reference in New Issue