Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] dissect_per_constrained_integer() with no_bound (MAX in ASN.1)

From: "Pavel Strnad" <strnadp@xxxxxxxxxx>
Date: Wed, 21 Dec 2016 15:37:54 +0100

Hello,

I am trying to understand the difference in usage of NO_BOUND or UINT_MAX in the place of max parameter in dissect_per_constrained_integer() function. In my case aligned PER variant.

 

From packet-per.h:

#define NO_BOUND -1

guint32 dissect_per_constrained_integer(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, guint32 min, guint32 max, guint32 *value, gboolean has_extension);

 

Based on that it looks like that there is no different dissection of following two asn.1 definitions?

1)      seconds     INTEGER (0..4294967295)

2)      seconds     INTEGER (0..MAX) where MAX translates to NO_BOUND=4294967295 using asn2wrs

 

Reading X.691 (aligned PER) wireshark seems to dissect well the 1st case that is using size constraint but not the 2nd case

where semi-constraint size is used and the length determinant should include padding bits in the case of aligned PER.

 

I would like to try to fix it myself but will need some hint how to differentiate these two cases and keep API unchanged?

 

Cheers,

Pavel