@@ -524,14 +524,14 @@ static int set_date(int year, int month, int day, struct tm *now_tm, time_t now,
524
524
if (year == -1 ) {
525
525
if (!now_tm )
526
526
return 1 ;
527
- r -> tm_year = now_tm -> tm_year ;
527
+ r -> tm_year = now_tm -> tm_year ; // CodeQL [SM03231] justification: Git's custom date parser intentionally handles years without leap year validation
528
528
}
529
529
else if (year >= 1970 && year < 2100 )
530
530
r -> tm_year = year - 1900 ;
531
531
else if (year > 70 && year < 100 )
532
532
r -> tm_year = year ;
533
533
else if (year < 38 )
534
- r -> tm_year = year + 100 ;
534
+ r -> tm_year = year + 100 ; // CodeQL [SM03231] justification: Git's date parser handles century offsets without leap year validation by design
535
535
else
536
536
return -1 ;
537
537
if (!now_tm )
@@ -548,7 +548,7 @@ static int set_date(int year, int month, int day, struct tm *now_tm, time_t now,
548
548
tm -> tm_mon = r -> tm_mon ;
549
549
tm -> tm_mday = r -> tm_mday ;
550
550
if (year != -1 )
551
- tm -> tm_year = r -> tm_year ;
551
+ tm -> tm_year = r -> tm_year ; // CodeQL [SM03231] justification: Git's date parser copies year values without requiring leap year validation
552
552
return 0 ;
553
553
}
554
554
return -1 ;
@@ -780,11 +780,11 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
780
780
/* Two-digit year? */
781
781
if (n == 2 && tm -> tm_year < 0 ) {
782
782
if (num < 10 && tm -> tm_mday >= 0 ) {
783
- tm -> tm_year = num + 100 ;
783
+ tm -> tm_year = num + 100 ; // CodeQL [SM03231] justification: Git's digit parser handles century calculation without leap year validation
784
784
return n ;
785
785
}
786
786
if (num >= 70 ) {
787
- tm -> tm_year = num ;
787
+ tm -> tm_year = num ; // CodeQL [SM03231] justification: Git's legacy date parser handles two-digit years without leap year validation by design
788
788
return n ;
789
789
}
790
790
}
@@ -1083,7 +1083,7 @@ static time_t update_tm(struct tm *tm, struct tm *now, time_t sec)
1083
1083
if (tm -> tm_year < 0 ) {
1084
1084
tm -> tm_year = now -> tm_year ;
1085
1085
if (tm -> tm_mon > now -> tm_mon )
1086
- tm -> tm_year -- ;
1086
+ tm -> tm_year -- ; // CodeQL [SM03231] justification: Git's date parser adjusts year to handle month comparisons without leap year validation
1087
1087
}
1088
1088
1089
1089
n = mktime (tm ) - sec ;
@@ -1110,9 +1110,9 @@ static void pending_number(struct tm *tm, int *num)
1110
1110
if (number > 1969 && number < 2100 )
1111
1111
tm -> tm_year = number - 1900 ;
1112
1112
else if (number > 69 && number < 100 )
1113
- tm -> tm_year = number ;
1113
+ tm -> tm_year = number ; // CodeQL [SM03231] justification: Git's approxidate parser intentionally assigns years without leap year checks
1114
1114
else if (number < 38 )
1115
- tm -> tm_year = 100 + number ;
1115
+ tm -> tm_year = 100 + number ; // CodeQL [SM03231] justification: Git's approxidate parser handles century calculation without leap year validation
1116
1116
/* We screw up for number = 00 ? */
1117
1117
}
1118
1118
}
@@ -1304,7 +1304,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm
1304
1304
* num = 0 ;
1305
1305
while (n < 0 ) {
1306
1306
n += 12 ;
1307
- tm -> tm_year -- ;
1307
+ tm -> tm_year -- ; // CodeQL [SM03231] justification: Git's approxidate parser adjusts years for month calculations without leap year concerns
1308
1308
}
1309
1309
tm -> tm_mon = n ;
1310
1310
* touched = 1 ;
@@ -1313,7 +1313,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm
1313
1313
1314
1314
if (match_string (date , "years" ) >= 4 ) {
1315
1315
update_tm (tm , now , 0 ); /* fill in date fields if needed */
1316
- tm -> tm_year -= * num ;
1316
+ tm -> tm_year -= * num ; // CodeQL [SM03231] justification: Git's approxidate parser subtracts years without leap year validation by design
1317
1317
* num = 0 ;
1318
1318
* touched = 1 ;
1319
1319
return end ;
0 commit comments