Skip to content

Commit 09730d4

Browse files
committed
gh-117534: Add checking for input parameter in iso_to_ymd
1 parent dc54714 commit 09730d4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Modules/_datetimemodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ iso_week1_monday(int year)
416416
static int
417417
iso_to_ymd(const int iso_year, const int iso_week, const int iso_day,
418418
int *year, int *month, int *day) {
419+
if (iso_year <= 0) {
420+
return -2;
421+
}
419422
if (iso_week <= 0 || iso_week >= 53) {
420423
int out_of_range = 1;
421424
if (iso_week == 53) {

0 commit comments

Comments
 (0)