-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
Description
Description
Hi,
In the following code, possible precision variable value being set to -1 and adjust_precision == true:
Lines 576 to 586 in 3a14ce1
| adjust_precision = true; | |
| fmt++; | |
| if (isdigit((int)*fmt)) { | |
| STR_TO_DEC(fmt, precision); | |
| } else if (*fmt == '*') { | |
| precision = va_arg(ap, int); | |
| fmt++; | |
| if (precision < -1) | |
| precision = -1; | |
| } else | |
| precision = 0; |
This can result undefined behavior when precision is later cast to size_t.
Line 845 in 3a14ce1
| if (adjust_precision && (size_t)precision < s_len) { |
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Reporter: Pavel Nekrasov ([email protected]).
Organization: Fobos-NT ([email protected]).
PHP Version
PHP 8.3
Operating System
Alt p10