summaryrefslogtreecommitdiff
path: root/ext/date/date_core.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-10-27 14:12:27 +0900
committergit <svn-admin@ruby-lang.org>2022-10-27 05:36:11 +0000
commit739ad81ff1ba28608fbc492cc0b09f96c0bd463a (patch)
treeede4219fbd065f53b833f95c596924326eda6345 /ext/date/date_core.c
parentcb80ee7a4a3967be3a0ce687ec76522f1680600b (diff)
[ruby/date] Check month range as civil
Diffstat (limited to 'ext/date/date_core.c')
-rw-r--r--ext/date/date_core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 96653e0a78..e58da719e0 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -761,6 +761,8 @@ c_valid_civil_p(int y, int m, int d, double sg,
if (m < 0)
m += 13;
+ if (m < 1 || m > 12)
+ return 0;
if (d < 0) {
if (!c_find_ldom(y, m, sg, rjd, ns))
return 0;