0010-Always-initialize-EXSLT-month-and-day-to-1.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 3309feb654036280d2355f8025150a69bfded6e2 Mon Sep 17 00:00:00 2001
  2. From: Nick Wellnhofer <wellnhofer@aevum.de>
  3. Date: Sun, 3 Jan 2016 16:45:24 +0100
  4. Subject: [PATCH] Always initialize EXSLT month and day to 1
  5. Fixes bug #757970
  6. https://bugzilla.gnome.org/show_bug.cgi?id=757970
  7. ---
  8. libexslt/date.c | 17 +++++++----------
  9. 1 file changed, 7 insertions(+), 10 deletions(-)
  10. diff --git a/libexslt/date.c b/libexslt/date.c
  11. index 9ca993c..272c61b 100644
  12. --- a/libexslt/date.c
  13. +++ b/libexslt/date.c
  14. @@ -667,6 +667,11 @@ exsltDateCreateDate (exsltDateType type)
  15. }
  16. memset (ret, 0, sizeof(exsltDateVal));
  17. + if (type != XS_DURATION) {
  18. + ret->value.date.mon = 1;
  19. + ret->value.date.day = 1;
  20. + }
  21. +
  22. if (type != EXSLT_UNKNOWN)
  23. ret->type = type;
  24. @@ -1395,10 +1400,10 @@ _exsltDateTruncateDate (exsltDateValPtr dt, exsltDateType type)
  25. }
  26. if ((type & XS_GDAY) != XS_GDAY)
  27. - dt->value.date.day = 0;
  28. + dt->value.date.day = 1;
  29. if ((type & XS_GMONTH) != XS_GMONTH)
  30. - dt->value.date.mon = 0;
  31. + dt->value.date.mon = 1;
  32. if ((type & XS_GYEAR) != XS_GYEAR)
  33. dt->value.date.year = 0;
  34. @@ -1473,18 +1478,10 @@ _exsltDateAdd (exsltDateValPtr dt, exsltDateValPtr dur)
  35. d = &(dt->value.date);
  36. u = &(dur->value.dur);
  37. - /* normalization */
  38. - if (d->mon == 0)
  39. - d->mon = 1;
  40. -
  41. /* normalize for time zone offset */
  42. u->sec -= (d->tzo * 60); /* changed from + to - (bug 153000) */
  43. d->tzo = 0;
  44. - /* normalization */
  45. - if (d->day == 0)
  46. - d->day = 1;
  47. -
  48. /* month */
  49. carry = d->mon + u->mon;
  50. r->mon = (unsigned int)MODULO_RANGE(carry, 1, 13);
  51. --
  52. 2.8.1