After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 540013 - g_date_valid_dmy should validate year
g_date_valid_dmy should validate year
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: datetime
unspecified
Other All
: Normal minor
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-06-24 18:23 UTC by Morten Welinder
Modified: 2018-04-13 14:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdate: Comment that g_date_valid_dmy() does all necessary bounds checks (2.68 KB, patch)
2018-04-12 17:18 UTC, Philip Withnall
committed Details | Review

Description Morten Welinder 2008-06-24 18:23:21 UTC
g_date_valid_dmy should check that the year is valid by storing it in a
local GDate structure and verify that the same value can be read from
there.  (Or, bluntly, check <= 65535.)
Comment 1 Philip Withnall 2018-04-12 17:18:03 UTC
Created attachment 370868 [details] [review]
gdate: Comment that g_date_valid_dmy() does all necessary bounds checks

Make it more obvious that an explicit check isn’t needed for the upper
bound on years, since it’s limited by the type width.

Add a unit test to demonstrate this.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Comment 2 Emmanuele Bassi (:ebassi) 2018-04-13 13:51:19 UTC
Review of attachment 370868 [details] [review]:

:thumbsup:
Comment 3 Philip Withnall 2018-04-13 14:32:46 UTC
Attachment 370868 [details] pushed as 33749d8 - gdate: Comment that g_date_valid_dmy() does all necessary bounds checks