Hacker News new | ask | show | jobs
by weinzierl 12 days ago
Making the thing that describes the bounds of an arbitrary length thing itself arbitrary length sound like an unnecessarily risky complication to me.

Especially since it only grows with the log of the thing it bounds. So, we could easily have s fixed length length field that covers all ever possible length values.

2 comments

Or you could just have the standard have a "Conformance Limits" section where it says something similar to "Every implementation shall support a length field value of at least 9223372036854775807, with an unlimited number of leading zeros".

In other words, values beyond that are not forbidden by the spec, but are outside of the conformance requirements. It is a quality of implementation issue whether a given implementation handles more than required.

That the spec is lenient and the conformance test strict makes ot only worse.
It's mathematically impossible to describe an arbitrary length in a fixed length.
Luckily in math we do not have to allocate memory and worry about buffer overflows.