bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: critique of gnulib - string allocation


From: Paul Eggert
Subject: Re: critique of gnulib - string allocation
Date: Sun, 8 Sep 2019 13:17:10 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]