]> Cypherpunks repositories - keks.git/commitdiff
Zero nsecs is ok for TAI64NA
authorSergey Matveev <stargrave@stargrave.org>
Thu, 21 Nov 2024 08:25:34 +0000 (11:25 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 21 Nov 2024 08:25:34 +0000 (11:25 +0300)
pyac/pyac.py

index 92f0ec46224b66b080609e866f4844d6e42c54655726d2609cf46e603fe400cf..670d88aa340f7918ccc498aab612926a72d69478dec9d8deb0f8c43685b1b5d4 100755 (executable)
@@ -298,7 +298,7 @@ def loads(v, sets=False, leapsecUTCAllow=False):
         nsecs = 0
         if l > 8:
             nsecs = int.from_bytes(v[1+8:1+8+4], "big")
-            if nsecs == 0:
+            if (l == 8) and (nsecs == 0):
                 raise DecodeError("non-minimal encoding")
             if nsecs > 999999999:
                 raise DecodeError("too many nanoseconds")