# About the enum type of per decode

This post is a wiki. Anyone with karma >750 is welcome to improve it.

In the function of packet-per.c, dissect_per_enumerated,when there is only one element in the extension part, why not need to decode the element?

the responding code is as follows:

......
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;
}
......


the above regulation cannot be seen in the enum type of per decode regulation

edit retag close merge delete

Sort by » oldest newest most voted

This is indeed a bug in Wireshark, thanks for reporting it. The fix is available here: https://code.wireshark.org/review/c/2... and will be backported in all the active branches.

more

Hi,

It comes from the definition of a constrained whole number encoding in ITU X.691 chapter 11.5.4 (Wireshark comment is based on an earlier X.691 specification where the corresponding chapter was 10.5.4).

more

In the ITU X.691 ,I think the enum type of per decode regulation should be as follows In the presence of an extension marker,if the value is not in the extension root it is encoded as a normally small non-negative whole number , not as a constrained whole number

( 2018-09-07 04:48:57 +0000 )edit

So do you have a pcap triggering this code that we could use to double check the behavior?

( 2018-09-07 06:13:03 +0000 )edit

Hi, after a second thought I agree with you: this specific case should be removed so as to systematically use the small non-negative whole number encoding. I'm gonna fix it right now, thanks for raising the point.

( 2018-09-07 07:36:04 +0000 )edit