stricter year parsing in Date

This commit is contained in:
Fabrice Bellard
2025-10-13 14:51:37 +02:00
parent 7fb994c45d
commit 2161640067
3 changed files with 3 additions and 5 deletions

View File

@@ -53839,11 +53839,11 @@ static BOOL js_date_parse_otherstring(const uint8_t *sp,
*is_local = FALSE;
}
} else {
if (p - p_start > 2) {
if (p - p_start > 2 && !has_year) {
fields[0] = val;
has_year = TRUE;
} else
if (val < 1 || val > 31) {
if ((val < 1 || val > 31) && !has_year) {
fields[0] = val + (val < 100) * 1900 + (val < 50) * 100;
has_year = TRUE;
} else {