Re: [PATCH 1/2] printf: fix heap buffer overflow in printf_builtin

2024-08-31 Thread Chet Ramey
On 8/30/24 10:41 AM, Martin D Kealey wrote: Hi Andrei Ok, I see the problem. This fault is triggered when the format string has '%(' but is missing the closing ')' - so the entire remainder of the format string is tentatively recorded as the time-format substring. Yes. This line: if (

Re: [PATCH 1/2] printf: fix heap buffer overflow in printf_builtin

2024-08-31 Thread Chet Ramey
On 8/29/24 10:21 AM, Andrey Kovalev wrote: In the loop, when iterating through the array, there was no check whether an element of the array goes beyond its limits. And with certain input data, there is an outflow from the array. Thanks for the report. -- ``The lyf so short, the craft so long

Re: [PATCH 1/2] printf: fix heap buffer overflow in printf_builtin

2024-08-30 Thread Martin D Kealey
Hi Andrei Ok, I see the problem. This fault is triggered when the format string has '%(' but is missing the closing ')' - so the entire remainder of the format string is tentatively recorded as the time-format substring. This line: if (*++fmt != 'T') should be changed to: if (n > 0 || *

Re: [PATCH 1/2] printf: fix heap buffer overflow in printf_builtin

2024-08-30 Thread Андрей Ковалёв
Hi there! I completely understand your point of view. Although I made a few mistakes when writing the patch, I wrote patch for a reason. I was doing fuzzing testing in bash4, and at some point during fuzzing, ASAN (AddressSanitizer) was launched. This problem also existed in the master branch

Re: [PATCH 1/2] printf: fix heap buffer overflow in printf_builtin

2024-08-29 Thread Andreas Schwab
On Aug 29 2024, Andrey Kovalev wrote: > - for (fmt = format; *fmt; fmt++) > + for (fmt = format; fmt - format < strlen(format); fmt++) How is that different (apart from turing a linear runtime into quadratic runtime)? -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint =