id3tag: Correctly validate the year from v1 tags before passing to GstDateTime
authorSebastian Dröge <sebastian@centricular.com>
Fri, 26 Apr 2019 06:44:07 +0000 (09:44 +0300)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 7 Aug 2019 12:33:59 +0000 (13:33 +0100)
commit6b03591281d35baa274985a107181168a7351731
tree695794a9107715d23edd298bda256161920c20a9
parente9236454b67ce165ea7a07ff0a6f16e02e07dd71
id3tag: Correctly validate the year from v1 tags before passing to GstDateTime

By using strtoul(), invalid values will get mapped to MAXULONG and we
would have to check errno. They won't get mapped to 0.

To solve this, use the signed g_ascii_strtoll(). This will map errors to
0 or G_MAXINT64 or G_MININT64, and the valid range for GstDateTime is >
0 and <= 9999 so we can directly check for this here.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/384
gst-libs/gst/tag/gstid3tag.c