]> git.pld-linux.org Git - packages/php.git/blob - php-5.3.6-bug-53574.patch
use /usr/sbin/php-fpm as other branches
[packages/php.git] / php-5.3.6-bug-53574.patch
1 --- PHP_5_3/ext/calendar/julian.c       2010/12/19 23:46:27     306474
2 +++ PHP_5_3/ext/calendar/julian.c       2010/12/19 23:47:00     306475
3 @@ -146,6 +146,7 @@
4   **************************************************************************/
5  
6  #include "sdncal.h"
7 +#include <limits.h>
8  
9  #define JULIAN_SDN_OFFSET         32083
10  #define DAYS_PER_5_MONTHS  153
11 @@ -164,15 +165,22 @@
12         int dayOfYear;
13  
14         if (sdn <= 0) {
15 -               *pYear = 0;
16 -               *pMonth = 0;
17 -               *pDay = 0;
18 -               return;
19 +               goto fail;
20         }
21 -       temp = (sdn + JULIAN_SDN_OFFSET) * 4 - 1;
22 +       /* Check for overflow */
23 +       if (sdn > (LONG_MAX - JULIAN_SDN_OFFSET * 4 + 1) / 4 || sdn < LONG_MIN / 4) {
24 +               goto fail;
25 +       }
26 +       temp = sdn * 4 + (JULIAN_SDN_OFFSET * 4 - 1);
27  
28         /* Calculate the year and day of year (1 <= dayOfYear <= 366). */
29 -       year = temp / DAYS_PER_4_YEARS;
30 +       {
31 +               long yearl = temp / DAYS_PER_4_YEARS;
32 +               if (yearl > INT_MAX || yearl < INT_MIN) {
33 +                       goto fail;
34 +               }
35 +               year = (int) yearl;
36 +       }
37         dayOfYear = (temp % DAYS_PER_4_YEARS) / 4 + 1;
38  
39         /* Calculate the month and day of month. */
40 @@ -196,6 +204,12 @@
41         *pYear = year;
42         *pMonth = month;
43         *pDay = day;
44 +       return;
45 +
46 +fail:
47 +       *pYear = 0;
48 +       *pMonth = 0;
49 +       *pDay = 0;
50  }
51  
52  long int JulianToSdn(
This page took 0.038347 seconds and 3 git commands to generate.