In particular, avoid out-of-buffer access and crashes with too big values, and rework documentation accordingly.