You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/home/dan/php-8.3.9/ext/session/session.c:1353:5: runtime error: signed integer overflow: 1728342208 + 9223372036854775807 cannot be represented in type 'long int'
Maybe the error occurs because the PS(cookie_lifetime) is already the max positive size of long.
But why does this overflow doesn't break anything on my machine?
And if the overflow is the problem, and the user can set cookie_lifetime to the max long int value, what are our options? Turning t into unsigned long?
Test the possible overflow before assigning t, and treating the overflow case with the LONG_MAX value from limits.h?
But why does this overflow doesn't break anything on my machine?
That overflow is undefined behavior; it may not necessarily cause issues, but should be fixed nonetheless. To reliably detect it, you either need to debug manually, or to employ something like UBSan.
Activity
MarcusXavierr commentedon Oct 8, 2024
I've tested it on a docker container with PHP 8.3.9 and went fine

I've also tested on my machine with PHP 8.2.15 and also didn't had any problem
Did you make any steps besides running this code?
MarcusXavierr commentedon Oct 8, 2024
Maybe the error occurs because the

PS(cookie_lifetime)is already the max positive size of long.But why does this overflow doesn't break anything on my machine?
And if the overflow is the problem, and the user can set cookie_lifetime to the max long int value, what are our options? Turning
tinto unsigned long?Test the possible overflow before assigning
t, and treating the overflow case with theLONG_MAXvalue fromlimits.h?cmb69 commentedon Oct 8, 2024
That overflow is undefined behavior; it may not necessarily cause issues, but should be fixed nonetheless. To reliably detect it, you either need to debug manually, or to employ something like UBSan.