bug-bash
[Top][All Lists]
Advanced

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

Re: Bash printf should diagnose integer overflow


From: Paul Eggert
Subject: Re: Bash printf should diagnose integer overflow
Date: Wed, 13 Mar 2024 17:57:30 -0700
User-agent: Mozilla Thunderbird

On 3/13/24 11:13, Chet Ramey wrote:

Thanks for the report. The most appropriate fix for this particular issue
is to display an error message if printf returns < 0, instead of
suppressing it unless the -v option has been set.

Oh, good point. This simplifies things a bit, though Bash still needs to do its own overflow checking for cases like "printf '%2147483648q' ''" and "printf '%*s' 2147483648 ''" when the Bash code itself is parsing the integer, rather than relying on printf(3) to do it.

Revised patchset attached. The first patch uses the fix you suggested; the remaining patches are similar to what I sent earlier, except the last one is simplified since it doesn't need to worry about inline width and precision when printf will do the checking. These patches are relative to Bash devel commit bf944fe91ffa97743ad86f6db6f3b84c78207a78 dated today at 09:33:32 -0400.

Attachment: 0001-printf-now-diagnoses-underlying-printf-failure.patch
Description: Text Data

Attachment: 0002-maint-add-support-for-C23-style-stdckdint.h.patch
Description: Text Data

Attachment: 0003-Coalesce-multiple-PRIdMAX-definitions.patch
Description: Text Data

Attachment: 0004-Fix-problems-with-large-brace-expansions.patch
Description: Text Data

Attachment: 0005-printf-now-diagnoses-more-width-prec-overflow.patch
Description: Text Data


reply via email to

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