|
| 1 | +--TEST-- |
| 2 | +GH-19371 (integer overflow in calendar.c) |
| 3 | +--SKIPIF-- |
| 4 | +<?php if (PHP_INT_SIZE !== 8) die("skip only for 64-bit"); ?> |
| 5 | +--EXTENSIONS-- |
| 6 | +calendar |
| 7 | +--FILE-- |
| 8 | +<?php |
| 9 | + |
| 10 | +try { |
| 11 | + echo cal_days_in_month(CAL_GREGORIAN, 12, PHP_INT_MAX); |
| 12 | +} catch (ValueError $e) { |
| 13 | + echo $e->getMessage(), "\n"; |
| 14 | +} |
| 15 | +try { |
| 16 | + echo cal_days_in_month(CAL_GREGORIAN, PHP_INT_MIN, 1); |
| 17 | +} catch (ValueError $e) { |
| 18 | + echo $e->getMessage(), "\n"; |
| 19 | +} |
| 20 | +try { |
| 21 | + echo cal_days_in_month(CAL_GREGORIAN, PHP_INT_MAX, 1); |
| 22 | +} catch (ValueError $e) { |
| 23 | + echo $e->getMessage(), "\n"; |
| 24 | +} |
| 25 | + |
| 26 | +try { |
| 27 | + echo cal_to_jd(CAL_GREGORIAN, PHP_INT_MIN, 1, 1); |
| 28 | +} catch (ValueError $e) { |
| 29 | + echo $e->getMessage(), "\n"; |
| 30 | +} |
| 31 | +try { |
| 32 | + echo cal_to_jd(CAL_GREGORIAN, PHP_INT_MAX, 1, 1); |
| 33 | +} catch (ValueError $e) { |
| 34 | + echo $e->getMessage(), "\n"; |
| 35 | +} |
| 36 | +try { |
| 37 | + echo cal_to_jd(CAL_GREGORIAN, 1, PHP_INT_MIN, 1); |
| 38 | +} catch (ValueError $e) { |
| 39 | + echo $e->getMessage(), "\n"; |
| 40 | +} |
| 41 | +try { |
| 42 | + echo cal_to_jd(CAL_GREGORIAN, 1, PHP_INT_MAX, 1); |
| 43 | +} catch (ValueError $e) { |
| 44 | + echo $e->getMessage(), "\n"; |
| 45 | +} |
| 46 | +try { |
| 47 | + echo cal_to_jd(CAL_GREGORIAN, 1, 1, PHP_INT_MAX); |
| 48 | +} catch (ValueError $e) { |
| 49 | + echo $e->getMessage(), "\n"; |
| 50 | +} |
| 51 | + |
| 52 | +?> |
| 53 | +--EXPECT-- |
| 54 | +cal_days_in_month(): Argument #3 ($year) must be less than 2147483646 |
| 55 | +cal_days_in_month(): Argument #2 ($month) must be between 1 and 2147483646 |
| 56 | +cal_days_in_month(): Argument #2 ($month) must be between 1 and 2147483646 |
| 57 | +cal_to_jd(): Argument #2 ($month) must be between 1 and 2147483646 |
| 58 | +cal_to_jd(): Argument #2 ($month) must be between 1 and 2147483646 |
| 59 | +cal_to_jd(): Argument #3 ($day) must be between -2147483648 and 2147483647 |
| 60 | +cal_to_jd(): Argument #3 ($day) must be between -2147483648 and 2147483647 |
| 61 | +cal_to_jd(): Argument #4 ($year) must be less than 2147483646 |
0 commit comments