concise-encoding icon indicating copy to clipboard operation
concise-encoding copied to clipboard

Numeric limits for CTE

Open kengruven opened this issue 4 years ago • 0 comments

I tried making a 2500-character integer (in CTE) and sending it to enctool. It happily made a >1KB CBE document. Then when I tried parsing that CBE with enctool, it said:

<nil>: uint length field is too big (max allowed value = 1024)

It looks like the CTE parser doesn't have the same limit check as CBE.

(Implementation note: since one format uses base-10 and the other uses base-128, what I'm doing is counting digits exactly for CTE, and checking the byte count against (maxdigits/10)*log(128) for CBE. I convinced myself that was correct, or close enough, though today I'm not so sure…)

kengruven avatar Jun 17 '21 21:06 kengruven