Wireshark-dev: [Wireshark-dev] asn2wrs: autodetection for 64 bits X constrained integers

From: "Pavel Strnad" <strnadp@xxxxxxxxxx>
Date: Wed, 25 Oct 2017 08:34:10 +0200
Hi list,
can we improve auto detection for 64b variant of constrained integers?
In the master branch we handle the cases of integers over/under +/- 2^32 but
what about MIX.. and ..MAX constants?
There are such dissectors in our current source tree: h245, t125, x509,..
that should use 64b instead of current 32b.

Can we use patch like bellow to improve it?

diff --git a/tools/asn2wrs.py b/tools/asn2wrs.py index
76cd10c674..6788bf09cd 100755
--- a/tools/asn2wrs.py
+++ b/tools/asn2wrs.py
@@ -3618,8 +3618,9 @@ class Constraint (Node):

     def Needs64b(self, ectx):
         (minv, maxv, ext) = self.GetValue(ectx)
-        if (str(minv).isdigit() or ((str(minv)[0] == "-") and
str(minv)[1:].isdigit())) \
-        and str(maxv).isdigit() and (abs(int(maxv) - int(minv)) >= 2**32):
+        if ((str(minv).isdigit() or ((str(minv)[0] == "-") and
str(minv)[1:].isdigit())) \
+        and str(maxv).isdigit() and (abs(int(maxv) - int(minv)) >= 2**32))
\
+        or (maxv == 'MAX') or (minv == 'MIN'):
             return True
         return False

Best Regards,
Pavel