[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master b5f17fe07c6: * admin/unidata/emoji-zwj.awk: Avoid sprint buff
From: |
Andreas Schwab |
Subject: |
Re: master b5f17fe07c6: * admin/unidata/emoji-zwj.awk: Avoid sprint buffer overflow |
Date: |
Sat, 03 Jun 2023 14:18:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Jun 03 2023, Robert Pluim wrote:
>>>>>> On Sat, 3 Jun 2023 06:58:23 -0400 (EDT), Mattias Engdegård
>>>>>> <mattiase@acm.org> said:
>
> Mattias> branch: master
> Mattias> commit b5f17fe07c6624380ba8d0c7a400a6b89f225209
> Mattias> Author: Mattias Engdegård <mattiase@acm.org>
> Mattias> Commit: Mattias Engdegård <mattiase@acm.org>
>
> Mattias> * admin/unidata/emoji-zwj.awk: Avoid sprint buffer overflow
>
> Mattias> Some AWK implementations have a fixed buffer for sprintf;
> for mawk the
> Mattias> default size is 8192 bytes. Hoist a string concatenation
> from
> Mattias> a sprintf call to avoid running into that limit. See
> discussion at
> Mattias>
> https://lists.gnu.org/archive/html/emacs-devel/2023-06/msg00090.html .
> Mattias> ---
> Mattias> admin/unidata/emoji-zwj.awk | 2 +-
> Mattias> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Mattias> diff --git a/admin/unidata/emoji-zwj.awk
> b/admin/unidata/emoji-zwj.awk
> Mattias> index f13f796bcac..4b648aa675e 100644
> Mattias> --- a/admin/unidata/emoji-zwj.awk
> Mattias> +++ b/admin/unidata/emoji-zwj.awk
> Mattias> @@ -106,7 +106,7 @@ END {
>
> Mattias> for (elt in ch)
> Mattias> {
> Mattias> - entries =
> sprintf("%s\n\"\\N{U+%s}\\N{U+FE0E}\"\n\"\\N{U+%s}\\N{U+FE0F}\"", vec[elt],
> elt, elt)
> Mattias> + entries = vec[elt]
> sprintf("\n\"\\N{U+%s}\\N{U+FE0E}\"\n\"\\N{U+%s}\\N{U+FE0F}\"", elt, elt)
> Mattias> printf("(#x%s .\n,(eval-when-compile
> (regexp-opt\n'(\n%s\n))))\n", elt, entries)
> Mattias> }
> Mattias> print "))"
>
> Fair enough. I always forget that awk can do string concatenation (and
> this should go to emacs-29 as well).
In fact, there is no need for sprintf in the first place.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."