On 9/8/19 10:08 AM, Bruno Haible wrote:
What do you mean by "asprintf mishandles large buffers"? The fact that an error
occurs if the result is longer than INT_MAX characters? Really, we have data
larger than 2 GB in many places, but *strings* larger than 2 GB?
Sure, in Emacs:
(length (make-string (ash 1 31) ?x))
2147483648
or in regular-expression matchers:
$ truncate -s 2GiB big
$ printf '\nx\n' >>big
$ ls -l big
-rw-r--r-- 1 eggert eggert 2147483651 Sep 8 13:15 big
$ grep -a x big
x
or in other places where GNU tools use strings to represent arbitrary
user-specified data. The GNU coding standards say to avoid arbitrary limits, and
on 64-bit platforms we should avoid arbitrary 32-bit limits on the lengths of
strings.