diff options
-rw-r--r-- | ext/date/lib/parse_date.c | 207 | ||||
-rw-r--r-- | ext/date/lib/parse_date.re | 11 | ||||
-rw-r--r-- | ext/date/tests/bug67251.phpt | 38 | ||||
-rw-r--r-- | ext/date/tests/bug67253.phpt | 44 | ||||
-rw-r--r-- | ext/standard/iptc.c | 3 | ||||
-rw-r--r-- | ext/standard/tests/image/bug67250.phpt | 8 | ||||
-rw-r--r-- | ext/standard/tests/strings/bug67252.phpt | 13 | ||||
-rw-r--r-- | ext/standard/uuencode.c | 3 |
8 files changed, 225 insertions, 102 deletions
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index fd67d8bf52..348482c0e4 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Thu Feb 6 07:35:53 2014 */ +/* Generated by re2c 0.13.5 on Tue May 13 17:01:57 2014 */ #line 1 "ext/date/lib/parse_date.re" /* +----------------------------------------------------------------------+ @@ -401,9 +401,12 @@ static timelib_sll timelib_meridian_with_check(char **ptr, timelib_sll h) { timelib_sll retval = 0; - while (!strchr("AaPp", **ptr)) { + while (**ptr && !strchr("AaPp", **ptr)) { ++*ptr; } + if(!**ptr) { + return TIMELIB_UNSET; + } if (**ptr == 'a' || **ptr == 'A') { if (h == 12) { retval = -12; @@ -837,11 +840,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) std: s->tok = cursor; s->len = 0; -#line 963 "ext/date/lib/parse_date.re" +#line 966 "ext/date/lib/parse_date.re" -#line 845 "ext/date/lib/parse_date.c" +#line 848 "ext/date/lib/parse_date.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -961,7 +964,7 @@ std: } yy2: YYDEBUG(2, *YYCURSOR); -#line 1049 "ext/date/lib/parse_date.re" +#line 1052 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("firstdayof | lastdayof"); TIMELIB_INIT; @@ -977,7 +980,7 @@ yy2: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 981 "ext/date/lib/parse_date.c" +#line 984 "ext/date/lib/parse_date.c" yy3: YYDEBUG(3, *YYCURSOR); ++YYCURSOR; @@ -1000,7 +1003,7 @@ yy3: } yy4: YYDEBUG(4, *YYCURSOR); -#line 1643 "ext/date/lib/parse_date.re" +#line 1646 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("tzcorrection | tz"); @@ -1013,7 +1016,7 @@ yy4: TIMELIB_DEINIT; return TIMELIB_TIMEZONE; } -#line 1017 "ext/date/lib/parse_date.c" +#line 1020 "ext/date/lib/parse_date.c" yy5: YYDEBUG(5, *YYCURSOR); yych = *++YYCURSOR; @@ -1324,12 +1327,12 @@ yy12: if (yych <= '9') goto yy1385; yy13: YYDEBUG(13, *YYCURSOR); -#line 1738 "ext/date/lib/parse_date.re" +#line 1741 "ext/date/lib/parse_date.re" { add_error(s, "Unexpected character"); goto std; } -#line 1333 "ext/date/lib/parse_date.c" +#line 1336 "ext/date/lib/parse_date.c" yy14: YYDEBUG(14, *YYCURSOR); yych = *++YYCURSOR; @@ -2386,11 +2389,11 @@ yy49: if (yych <= '9') goto yy55; yy50: YYDEBUG(50, *YYCURSOR); -#line 1727 "ext/date/lib/parse_date.re" +#line 1730 "ext/date/lib/parse_date.re" { goto std; } -#line 2394 "ext/date/lib/parse_date.c" +#line 2397 "ext/date/lib/parse_date.c" yy51: YYDEBUG(51, *YYCURSOR); yych = *++YYCURSOR; @@ -2399,12 +2402,12 @@ yy52: YYDEBUG(52, *YYCURSOR); ++YYCURSOR; YYDEBUG(53, *YYCURSOR); -#line 1732 "ext/date/lib/parse_date.re" +#line 1735 "ext/date/lib/parse_date.re" { s->pos = cursor; s->line++; goto std; } -#line 2408 "ext/date/lib/parse_date.c" +#line 2411 "ext/date/lib/parse_date.c" yy54: YYDEBUG(54, *YYCURSOR); yych = *++YYCURSOR; @@ -2791,7 +2794,7 @@ yy72: if (yych == 's') goto yy74; yy73: YYDEBUG(73, *YYCURSOR); -#line 1711 "ext/date/lib/parse_date.re" +#line 1714 "ext/date/lib/parse_date.re" { timelib_ull i; DEBUG_OUTPUT("relative"); @@ -2806,7 +2809,7 @@ yy73: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 2810 "ext/date/lib/parse_date.c" +#line 2813 "ext/date/lib/parse_date.c" yy74: YYDEBUG(74, *YYCURSOR); yych = *++YYCURSOR; @@ -3568,7 +3571,7 @@ yy166: } yy167: YYDEBUG(167, *YYCURSOR); -#line 1574 "ext/date/lib/parse_date.re" +#line 1577 "ext/date/lib/parse_date.re" { const timelib_relunit* relunit; DEBUG_OUTPUT("daytext"); @@ -3585,7 +3588,7 @@ yy167: TIMELIB_DEINIT; return TIMELIB_WEEKDAY; } -#line 3589 "ext/date/lib/parse_date.c" +#line 3592 "ext/date/lib/parse_date.c" yy168: YYDEBUG(168, *YYCURSOR); yych = *++YYCURSOR; @@ -4105,7 +4108,7 @@ yy193: } yy194: YYDEBUG(194, *YYCURSOR); -#line 1633 "ext/date/lib/parse_date.re" +#line 1636 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("monthtext"); TIMELIB_INIT; @@ -4114,7 +4117,7 @@ yy194: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4118 "ext/date/lib/parse_date.c" +#line 4121 "ext/date/lib/parse_date.c" yy195: YYDEBUG(195, *YYCURSOR); ++YYCURSOR; @@ -4165,7 +4168,7 @@ yy198: } yy199: YYDEBUG(199, *YYCURSOR); -#line 1379 "ext/date/lib/parse_date.re" +#line 1382 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datetextual | datenoyear"); @@ -4178,7 +4181,7 @@ yy199: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4182 "ext/date/lib/parse_date.c" +#line 4185 "ext/date/lib/parse_date.c" yy200: YYDEBUG(200, *YYCURSOR); yyaccept = 6; @@ -4447,7 +4450,7 @@ yy222: } yy223: YYDEBUG(223, *YYCURSOR); -#line 1681 "ext/date/lib/parse_date.re" +#line 1684 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz"); @@ -4476,7 +4479,7 @@ yy223: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 4480 "ext/date/lib/parse_date.c" +#line 4483 "ext/date/lib/parse_date.c" yy224: YYDEBUG(224, *YYCURSOR); yyaccept = 7; @@ -5174,7 +5177,7 @@ yy278: YYDEBUG(278, *YYCURSOR); ++YYCURSOR; YYDEBUG(279, *YYCURSOR); -#line 1657 "ext/date/lib/parse_date.re" +#line 1660 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12"); TIMELIB_INIT; @@ -5197,7 +5200,7 @@ yy278: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 5201 "ext/date/lib/parse_date.c" +#line 5204 "ext/date/lib/parse_date.c" yy280: YYDEBUG(280, *YYCURSOR); yych = *++YYCURSOR; @@ -5375,7 +5378,7 @@ yy294: ++YYCURSOR; yy295: YYDEBUG(295, *YYCURSOR); -#line 1351 "ext/date/lib/parse_date.re" +#line 1354 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datenoday"); @@ -5388,7 +5391,7 @@ yy295: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 5392 "ext/date/lib/parse_date.c" +#line 5395 "ext/date/lib/parse_date.c" yy296: YYDEBUG(296, *YYCURSOR); yych = *++YYCURSOR; @@ -6608,7 +6611,7 @@ yy362: if (yych <= '9') goto yy365; yy364: YYDEBUG(364, *YYCURSOR); -#line 1495 "ext/date/lib/parse_date.re" +#line 1498 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextshort"); @@ -6621,7 +6624,7 @@ yy364: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 6625 "ext/date/lib/parse_date.c" +#line 6628 "ext/date/lib/parse_date.c" yy365: YYDEBUG(365, *YYCURSOR); yych = *++YYCURSOR; @@ -7259,7 +7262,7 @@ yy392: } yy393: YYDEBUG(393, *YYCURSOR); -#line 1553 "ext/date/lib/parse_date.re" +#line 1556 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("ago"); TIMELIB_INIT; @@ -7279,7 +7282,7 @@ yy393: TIMELIB_DEINIT; return TIMELIB_AGO; } -#line 7283 "ext/date/lib/parse_date.c" +#line 7286 "ext/date/lib/parse_date.c" yy394: YYDEBUG(394, *YYCURSOR); yyaccept = 5; @@ -9029,7 +9032,7 @@ yy454: ++YYCURSOR; yy455: YYDEBUG(455, *YYCURSOR); -#line 1256 "ext/date/lib/parse_date.re" +#line 1259 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash"); TIMELIB_INIT; @@ -9040,7 +9043,7 @@ yy455: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 9044 "ext/date/lib/parse_date.c" +#line 9047 "ext/date/lib/parse_date.c" yy456: YYDEBUG(456, *YYCURSOR); yyaccept = 0; @@ -9600,7 +9603,7 @@ yy475: } yy476: YYDEBUG(476, *YYCURSOR); -#line 1393 "ext/date/lib/parse_date.re" +#line 1396 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("datenoyearrev"); TIMELIB_INIT; @@ -9611,7 +9614,7 @@ yy476: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 9615 "ext/date/lib/parse_date.c" +#line 9618 "ext/date/lib/parse_date.c" yy477: YYDEBUG(477, *YYCURSOR); yyaccept = 10; @@ -9752,7 +9755,7 @@ yy488: YYDEBUG(488, *YYCURSOR); ++YYCURSOR; YYDEBUG(489, *YYCURSOR); -#line 1111 "ext/date/lib/parse_date.re" +#line 1114 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12"); TIMELIB_INIT; @@ -9768,7 +9771,7 @@ yy488: TIMELIB_DEINIT; return TIMELIB_TIME12; } -#line 9772 "ext/date/lib/parse_date.c" +#line 9775 "ext/date/lib/parse_date.c" yy490: YYDEBUG(490, *YYCURSOR); yyaccept = 11; @@ -9781,7 +9784,7 @@ yy490: } yy491: YYDEBUG(491, *YYCURSOR); -#line 1148 "ext/date/lib/parse_date.re" +#line 1151 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long"); @@ -9806,7 +9809,7 @@ yy491: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 9810 "ext/date/lib/parse_date.c" +#line 9813 "ext/date/lib/parse_date.c" yy492: YYDEBUG(492, *YYCURSOR); yyaccept = 11; @@ -10116,7 +10119,7 @@ yy523: YYDEBUG(523, *YYCURSOR); ++YYCURSOR; YYDEBUG(524, *YYCURSOR); -#line 1128 "ext/date/lib/parse_date.re" +#line 1131 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("mssqltime"); TIMELIB_INIT; @@ -10135,7 +10138,7 @@ yy523: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 10139 "ext/date/lib/parse_date.c" +#line 10142 "ext/date/lib/parse_date.c" yy525: YYDEBUG(525, *YYCURSOR); yyaccept = 11; @@ -10241,7 +10244,7 @@ yy534: if (yych <= '9') goto yy541; yy535: YYDEBUG(535, *YYCURSOR); -#line 1310 "ext/date/lib/parse_date.re" +#line 1313 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datefull"); @@ -10255,7 +10258,7 @@ yy535: TIMELIB_DEINIT; return TIMELIB_DATE_FULL; } -#line 10259 "ext/date/lib/parse_date.c" +#line 10262 "ext/date/lib/parse_date.c" yy536: YYDEBUG(536, *YYCURSOR); yych = *++YYCURSOR; @@ -10992,7 +10995,7 @@ yy605: YYDEBUG(606, *YYCURSOR); ++YYCURSOR; YYDEBUG(607, *YYCURSOR); -#line 1325 "ext/date/lib/parse_date.re" +#line 1328 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("pointed date YYYY"); TIMELIB_INIT; @@ -11003,7 +11006,7 @@ yy605: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 11007 "ext/date/lib/parse_date.c" +#line 11010 "ext/date/lib/parse_date.c" yy608: YYDEBUG(608, *YYCURSOR); yyaccept = 11; @@ -11039,7 +11042,7 @@ yy611: if (yych <= '9') goto yy605; yy612: YYDEBUG(612, *YYCURSOR); -#line 1337 "ext/date/lib/parse_date.re" +#line 1340 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pointed date YY"); @@ -11052,7 +11055,7 @@ yy612: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 11056 "ext/date/lib/parse_date.c" +#line 11059 "ext/date/lib/parse_date.c" yy613: YYDEBUG(613, *YYCURSOR); yyaccept = 11; @@ -11693,7 +11696,7 @@ yy656: } yy657: YYDEBUG(657, *YYCURSOR); -#line 1296 "ext/date/lib/parse_date.re" +#line 1299 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshort"); @@ -11706,7 +11709,7 @@ yy657: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 11710 "ext/date/lib/parse_date.c" +#line 11713 "ext/date/lib/parse_date.c" yy658: YYDEBUG(658, *YYCURSOR); yyaccept = 13; @@ -11812,7 +11815,7 @@ yy666: } yy667: YYDEBUG(667, *YYCURSOR); -#line 1240 "ext/date/lib/parse_date.re" +#line 1243 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("americanshort | american"); @@ -11827,7 +11830,7 @@ yy667: TIMELIB_DEINIT; return TIMELIB_AMERICAN; } -#line 11831 "ext/date/lib/parse_date.c" +#line 11834 "ext/date/lib/parse_date.c" yy668: YYDEBUG(668, *YYCURSOR); yyaccept = 14; @@ -12060,7 +12063,7 @@ yy700: if (yych <= ':') goto yy704; yy701: YYDEBUG(701, *YYCURSOR); -#line 1523 "ext/date/lib/parse_date.re" +#line 1526 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("clf"); @@ -12080,7 +12083,7 @@ yy701: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12084 "ext/date/lib/parse_date.c" +#line 12087 "ext/date/lib/parse_date.c" yy702: YYDEBUG(702, *YYCURSOR); yych = *++YYCURSOR; @@ -12632,7 +12635,7 @@ yy763: } yy764: YYDEBUG(764, *YYCURSOR); -#line 1268 "ext/date/lib/parse_date.re" +#line 1271 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("iso8601date2"); @@ -12645,7 +12648,7 @@ yy764: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 12649 "ext/date/lib/parse_date.c" +#line 12652 "ext/date/lib/parse_date.c" yy765: YYDEBUG(765, *YYCURSOR); yych = *++YYCURSOR; @@ -12684,7 +12687,7 @@ yy771: YYDEBUG(771, *YYCURSOR); ++YYCURSOR; YYDEBUG(772, *YYCURSOR); -#line 1509 "ext/date/lib/parse_date.re" +#line 1512 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextreverse"); @@ -12697,7 +12700,7 @@ yy771: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 12701 "ext/date/lib/parse_date.c" +#line 12704 "ext/date/lib/parse_date.c" yy773: YYDEBUG(773, *YYCURSOR); yych = *++YYCURSOR; @@ -12835,7 +12838,7 @@ yy783: } yy784: YYDEBUG(784, *YYCURSOR); -#line 1544 "ext/date/lib/parse_date.re" +#line 1547 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("year4"); TIMELIB_INIT; @@ -12843,7 +12846,7 @@ yy784: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12847 "ext/date/lib/parse_date.c" +#line 12850 "ext/date/lib/parse_date.c" yy785: YYDEBUG(785, *YYCURSOR); yych = *++YYCURSOR; @@ -12994,7 +12997,7 @@ yy793: } yy794: YYDEBUG(794, *YYCURSOR); -#line 1365 "ext/date/lib/parse_date.re" +#line 1368 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datenodayrev"); @@ -13007,7 +13010,7 @@ yy794: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 13011 "ext/date/lib/parse_date.c" +#line 13014 "ext/date/lib/parse_date.c" yy795: YYDEBUG(795, *YYCURSOR); yych = *++YYCURSOR; @@ -13222,7 +13225,7 @@ yy814: if (yych <= '7') goto yy817; yy815: YYDEBUG(815, *YYCURSOR); -#line 1476 "ext/date/lib/parse_date.re" +#line 1479 "ext/date/lib/parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweek"); @@ -13240,7 +13243,7 @@ yy815: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 13244 "ext/date/lib/parse_date.c" +#line 13247 "ext/date/lib/parse_date.c" yy816: YYDEBUG(816, *YYCURSOR); yych = *++YYCURSOR; @@ -13250,7 +13253,7 @@ yy817: YYDEBUG(817, *YYCURSOR); ++YYCURSOR; YYDEBUG(818, *YYCURSOR); -#line 1457 "ext/date/lib/parse_date.re" +#line 1460 "ext/date/lib/parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweekday"); @@ -13268,7 +13271,7 @@ yy817: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 13272 "ext/date/lib/parse_date.c" +#line 13275 "ext/date/lib/parse_date.c" yy819: YYDEBUG(819, *YYCURSOR); yych = *++YYCURSOR; @@ -13332,7 +13335,7 @@ yy821: } yy822: YYDEBUG(822, *YYCURSOR); -#line 1443 "ext/date/lib/parse_date.re" +#line 1446 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgydotd"); @@ -13345,7 +13348,7 @@ yy822: TIMELIB_DEINIT; return TIMELIB_PG_YEARDAY; } -#line 13349 "ext/date/lib/parse_date.c" +#line 13352 "ext/date/lib/parse_date.c" yy823: YYDEBUG(823, *YYCURSOR); yych = *++YYCURSOR; @@ -13448,7 +13451,7 @@ yy842: ++YYCURSOR; yy843: YYDEBUG(843, *YYCURSOR); -#line 1417 "ext/date/lib/parse_date.re" +#line 1420 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif"); @@ -13473,7 +13476,7 @@ yy843: TIMELIB_DEINIT; return TIMELIB_XMLRPC_SOAP; } -#line 13477 "ext/date/lib/parse_date.c" +#line 13480 "ext/date/lib/parse_date.c" yy844: YYDEBUG(844, *YYCURSOR); yych = *++YYCURSOR; @@ -13735,7 +13738,7 @@ yy848: } yy849: YYDEBUG(849, *YYCURSOR); -#line 1405 "ext/date/lib/parse_date.re" +#line 1408 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("datenocolon"); TIMELIB_INIT; @@ -13746,7 +13749,7 @@ yy849: TIMELIB_DEINIT; return TIMELIB_DATE_NOCOLON; } -#line 13750 "ext/date/lib/parse_date.c" +#line 13753 "ext/date/lib/parse_date.c" yy850: YYDEBUG(850, *YYCURSOR); yych = *++YYCURSOR; @@ -14666,7 +14669,7 @@ yy973: if (yych <= '9') goto yy996; yy974: YYDEBUG(974, *YYCURSOR); -#line 1282 "ext/date/lib/parse_date.re" +#line 1285 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshorter"); @@ -14679,7 +14682,7 @@ yy974: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 14683 "ext/date/lib/parse_date.c" +#line 14686 "ext/date/lib/parse_date.c" yy975: YYDEBUG(975, *YYCURSOR); yyaccept = 22; @@ -15688,7 +15691,7 @@ yy1066: } yy1068: YYDEBUG(1068, *YYCURSOR); -#line 1174 "ext/date/lib/parse_date.re" +#line 1177 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("gnunocolon"); TIMELIB_INIT; @@ -15710,7 +15713,7 @@ yy1068: TIMELIB_DEINIT; return TIMELIB_GNU_NOCOLON; } -#line 15714 "ext/date/lib/parse_date.c" +#line 15717 "ext/date/lib/parse_date.c" yy1069: YYDEBUG(1069, *YYCURSOR); yych = *++YYCURSOR; @@ -15802,7 +15805,7 @@ yy1075: } yy1076: YYDEBUG(1076, *YYCURSOR); -#line 1220 "ext/date/lib/parse_date.re" +#line 1223 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("iso8601nocolon"); @@ -15821,7 +15824,7 @@ yy1076: TIMELIB_DEINIT; return TIMELIB_ISO_NOCOLON; } -#line 15825 "ext/date/lib/parse_date.c" +#line 15828 "ext/date/lib/parse_date.c" yy1077: YYDEBUG(1077, *YYCURSOR); yyaccept = 25; @@ -16719,7 +16722,7 @@ yy1117: } yy1118: YYDEBUG(1118, *YYCURSOR); -#line 1616 "ext/date/lib/parse_date.re" +#line 1619 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16735,7 +16738,7 @@ yy1118: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 16739 "ext/date/lib/parse_date.c" +#line 16742 "ext/date/lib/parse_date.c" yy1119: YYDEBUG(1119, *YYCURSOR); ++YYCURSOR; @@ -16786,7 +16789,7 @@ yy1126: YYDEBUG(1126, *YYCURSOR); ++YYCURSOR; YYDEBUG(1127, *YYCURSOR); -#line 1089 "ext/date/lib/parse_date.re" +#line 1092 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16807,7 +16810,7 @@ yy1126: TIMELIB_DEINIT; return TIMELIB_WEEK_DAY_OF_MONTH; } -#line 16811 "ext/date/lib/parse_date.c" +#line 16814 "ext/date/lib/parse_date.c" yy1128: YYDEBUG(1128, *YYCURSOR); yyaccept = 26; @@ -16915,7 +16918,7 @@ yy1141: } yy1142: YYDEBUG(1142, *YYCURSOR); -#line 1592 "ext/date/lib/parse_date.re" +#line 1595 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16938,7 +16941,7 @@ yy1142: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 16942 "ext/date/lib/parse_date.c" +#line 16945 "ext/date/lib/parse_date.c" yy1143: YYDEBUG(1143, *YYCURSOR); yych = *++YYCURSOR; @@ -19615,7 +19618,7 @@ yy1294: goto yy1298; yy1295: YYDEBUG(1295, *YYCURSOR); -#line 1066 "ext/date/lib/parse_date.re" +#line 1069 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("backof | frontof"); TIMELIB_INIT; @@ -19637,7 +19640,7 @@ yy1295: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 19641 "ext/date/lib/parse_date.c" +#line 19644 "ext/date/lib/parse_date.c" yy1296: YYDEBUG(1296, *YYCURSOR); yyaccept = 28; @@ -21328,7 +21331,7 @@ yy1385: if (yych <= '9') goto yy1385; yy1387: YYDEBUG(1387, *YYCURSOR); -#line 1023 "ext/date/lib/parse_date.re" +#line 1026 "ext/date/lib/parse_date.re" { timelib_ull i; @@ -21353,7 +21356,7 @@ yy1387: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21357 "ext/date/lib/parse_date.c" +#line 21360 "ext/date/lib/parse_date.c" yy1388: YYDEBUG(1388, *YYCURSOR); yych = *++YYCURSOR; @@ -21789,7 +21792,7 @@ yy1416: ++YYCURSOR; yy1417: YYDEBUG(1417, *YYCURSOR); -#line 1011 "ext/date/lib/parse_date.re" +#line 1014 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("tomorrow"); TIMELIB_INIT; @@ -21800,7 +21803,7 @@ yy1417: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21804 "ext/date/lib/parse_date.c" +#line 21807 "ext/date/lib/parse_date.c" yy1418: YYDEBUG(1418, *YYCURSOR); yych = *++YYCURSOR; @@ -21835,7 +21838,7 @@ yy1419: } yy1420: YYDEBUG(1420, *YYCURSOR); -#line 1001 "ext/date/lib/parse_date.re" +#line 1004 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("midnight | today"); TIMELIB_INIT; @@ -21844,7 +21847,7 @@ yy1420: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21848 "ext/date/lib/parse_date.c" +#line 21851 "ext/date/lib/parse_date.c" yy1421: YYDEBUG(1421, *YYCURSOR); yych = *++YYCURSOR; @@ -23856,7 +23859,7 @@ yy1499: } yy1500: YYDEBUG(1500, *YYCURSOR); -#line 980 "ext/date/lib/parse_date.re" +#line 983 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("now"); TIMELIB_INIT; @@ -23864,7 +23867,7 @@ yy1500: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 23868 "ext/date/lib/parse_date.c" +#line 23871 "ext/date/lib/parse_date.c" yy1501: YYDEBUG(1501, *YYCURSOR); yych = *++YYCURSOR; @@ -24003,7 +24006,7 @@ yy1507: } yy1508: YYDEBUG(1508, *YYCURSOR); -#line 989 "ext/date/lib/parse_date.re" +#line 992 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("noon"); TIMELIB_INIT; @@ -24014,7 +24017,7 @@ yy1508: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 24018 "ext/date/lib/parse_date.c" +#line 24021 "ext/date/lib/parse_date.c" yy1509: YYDEBUG(1509, *YYCURSOR); yyaccept = 0; @@ -24547,7 +24550,7 @@ yy1530: ++YYCURSOR; yy1531: YYDEBUG(1531, *YYCURSOR); -#line 968 "ext/date/lib/parse_date.re" +#line 971 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("yesterday"); TIMELIB_INIT; @@ -24558,7 +24561,7 @@ yy1531: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 24562 "ext/date/lib/parse_date.c" +#line 24565 "ext/date/lib/parse_date.c" yy1532: YYDEBUG(1532, *YYCURSOR); yyaccept = 0; @@ -24731,7 +24734,7 @@ yy1537: goto yy1531; } } -#line 1742 "ext/date/lib/parse_date.re" +#line 1745 "ext/date/lib/parse_date.re" } @@ -25090,7 +25093,11 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim break; case '\\': /* escaped char */ - ++fptr; + if(!fptr[1]) { + add_pbf_error(s, "Escaped character expected", string, begin); + break; + } + fptr++; if (*ptr == *fptr) { ++ptr; } else { diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index e01e292e10..bbae794418 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -399,9 +399,12 @@ static timelib_sll timelib_meridian_with_check(char **ptr, timelib_sll h) { timelib_sll retval = 0; - while (!strchr("AaPp", **ptr)) { + while (**ptr && !strchr("AaPp", **ptr)) { ++*ptr; } + if(!**ptr) { + return TIMELIB_UNSET; + } if (**ptr == 'a' || **ptr == 'A') { if (h == 12) { retval = -12; @@ -2097,7 +2100,11 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim break; case '\\': /* escaped char */ - ++fptr; + if(!fptr[1]) { + add_pbf_error(s, "Escaped character expected", string, begin); + break; + } + fptr++; if (*ptr == *fptr) { ++ptr; } else { diff --git a/ext/date/tests/bug67251.phpt b/ext/date/tests/bug67251.phpt new file mode 100644 index 0000000000..68c56a1613 --- /dev/null +++ b/ext/date/tests/bug67251.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #67251 (date_parse_from_format out-of-bounds read) +--INI-- +date.timezone=Europe/Berlin +--FILE-- +<?php +var_dump(date_parse_from_format("\\","AAAABBBB")); +--EXPECT-- +array(12) { + ["year"]=> + bool(false) + ["month"]=> + bool(false) + ["day"]=> + bool(false) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(2) + ["errors"]=> + array(1) { + [0]=> + string(13) "Trailing data" + } + ["is_localtime"]=> + bool(false) +} diff --git a/ext/date/tests/bug67253.phpt b/ext/date/tests/bug67253.phpt new file mode 100644 index 0000000000..b28cbe63c1 --- /dev/null +++ b/ext/date/tests/bug67253.phpt @@ -0,0 +1,44 @@ +--TEST-- +Bug #67253 (timelib_meridian_with_check out-of-bounds read) +--INI-- +date.timezone=Europe/Berlin +--FILE-- +<?php +$z = ''; +var_dump(date_parse_from_format("aHa0", "0=G{$z}9UCNnF")); +--EXPECT-- +array(12) { + ["year"]=> + bool(false) + ["month"]=> + bool(false) + ["day"]=> + bool(false) + ["hour"]=> + int(0) + ["minute"]=> + int(0) + ["second"]=> + int(0) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(3) + ["errors"]=> + array(3) { + [0]=> + string(51) "Meridian can only come after an hour has been found" + [1]=> + string(29) "A meridian could not be found" + [9]=> + string(12) "Data missing" + } + ["is_localtime"]=> + bool(false) +} + diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index 3257339106..ad4fa65029 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -329,6 +329,9 @@ PHP_FUNCTION(iptcparse) recnum = buffer[ inx++ ]; if (buffer[ inx ] & (unsigned char) 0x80) { /* long tag */ + if((inx+6) >= str_len) { + break; + } len = (((long) buffer[ inx + 2 ]) << 24) + (((long) buffer[ inx + 3 ]) << 16) + (((long) buffer[ inx + 4 ]) << 8) + (((long) buffer[ inx + 5 ])); inx += 6; diff --git a/ext/standard/tests/image/bug67250.phpt b/ext/standard/tests/image/bug67250.phpt new file mode 100644 index 0000000000..607de9f3b6 --- /dev/null +++ b/ext/standard/tests/image/bug67250.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #67250 (iptcparse out-of-bounds read) +--FILE-- +<?php +var_dump(iptcparse("\x1C\x02_\x80___")); +?> +--EXPECT-- +bool(false) diff --git a/ext/standard/tests/strings/bug67252.phpt b/ext/standard/tests/strings/bug67252.phpt new file mode 100644 index 0000000000..80a6ebcf1c --- /dev/null +++ b/ext/standard/tests/strings/bug67252.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #67252 (convert_uudecode out-of-bounds read) +--FILE-- +<?php + +$a = "M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A"."\n"."a."; +var_dump(convert_uudecode($a)); + +?> +--EXPECTF-- + +Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d +bool(false) diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index 52e892ed9e..8544aef9f0 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -151,6 +151,9 @@ PHPAPI int php_uudecode(char *src, int src_len, char **dest) /* {{{ */ } while (s < ee) { + if(s+4 > e) { + goto err; + } *p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4; *p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2; *p++ = PHP_UU_DEC(*(s + 2)) << 6 | PHP_UU_DEC(*(s + 3)); |