[SERVER-40383] dateFromParts does not overflow correctly if isoWeek smaller than 1 Created: 29/Mar/19 Updated: 29/Oct/23 Resolved: 01/Jul/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 4.0.6 |
| Fix Version/s: | 4.0.11, 4.2.0-rc3, 4.3.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Sam Tolmay | Assignee: | Justin Seyster |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Backport Requested: |
v4.2, v4.0, v3.6
|
||||||||||||||||||||
| Sprint: | Query 2019-05-06, Query 2019-05-20, Query 2019-06-03, Query 2019-06-17, Query 2019-07-01, Query 2019-07-15 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 31 | ||||||||||||||||||||
| Description |
|
When using dateFromParts with ISO8601 weeks, the date does not calculate correctly if the isoWeek parameter is less than 1. Some examples:
|
| Comments |
| Comment by Githook User [ 01/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Justin Seyster', 'username': 'jseyster', 'email': 'justin.seyster@mongodb.com'}Message: (cherry picked from commit d4843fc49931c7ce4332dc373623267c293eb518) | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 01/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Justin Seyster', 'username': 'jseyster', 'email': 'justin.seyster@mongodb.com'}Message: (cherry picked from commit d4843fc49931c7ce4332dc373623267c293eb518) | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 01/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Justin Seyster', 'username': 'jseyster', 'email': 'justin.seyster@mongodb.com'}Message: | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Derick Rethans [ 30/Jun/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
I've merged this patch in timelib now: https://github.com/derickr/timelib/pull/66 | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Justin Seyster [ 04/Jun/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
The proposed changes introduce some minor changes in behavior that will cause failures in the multiversion fuzzer if we don't include the same changes from v4.0 up to master. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by David Storch [ 10/Apr/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Hi SamTolmay, Thanks for the issue report! I spent some time tracking this down, and there is definitely a flaw in year-related arithmetic in timelib_date_from_isodate(). The problematic code is little bit arcane, but I've prepared a fix that also simplifies the logic around computing the correct year:
| ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Danny Hatcher (Inactive) [ 29/Mar/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Hello Sam, Thank you for the report. I've forwarded this on to our query team to determine whether this was intentionally not done for ISO or is a bug. Danny |