gd-2.2.4-upstream.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From c9b601a658a79e6ea2aad29fbf60ca6e24ccef1e Mon Sep 17 00:00:00 2001
  2. From: "Christoph M. Becker" <cmbecker69@gmx.de>
  3. Date: Wed, 18 Jan 2017 13:59:02 +0100
  4. Subject: [PATCH] Fix build issue regarding INT_MAX
  5. For portability gd_gd2.c needs to include <limits.h>.
  6. ---
  7. src/gd_gd2.c | 1 +
  8. 1 file changed, 1 insertion(+)
  9. diff --git a/src/gd_gd2.c b/src/gd_gd2.c
  10. index c2904ca..049c4c5 100644
  11. --- a/src/gd_gd2.c
  12. +++ b/src/gd_gd2.c
  13. @@ -74,6 +74,7 @@
  14. /* 2.0.29: no more errno.h, makes windows happy */
  15. #include <math.h>
  16. +#include <limits.h>
  17. #include <string.h>
  18. #include "gd.h"
  19. #include "gd_errors.h"
  20. From 55ac28a293eaa8c531870c8bb8ecc04b333975f4 Mon Sep 17 00:00:00 2001
  21. From: "Christoph M. Becker" <cmbecker69@gmx.de>
  22. Date: Thu, 19 Jan 2017 01:02:58 +0100
  23. Subject: [PATCH] Fix #357: 2.2.4: Segfault in test suite.
  24. We make sure to never pass a negative `int` as argument to a `size_t`
  25. parameter.
  26. ---
  27. src/gd_io_dp.c | 4 ++++
  28. 1 file changed, 4 insertions(+)
  29. diff --git a/src/gd_io_dp.c b/src/gd_io_dp.c
  30. index eda2eeb..cb38794 100644
  31. --- a/src/gd_io_dp.c
  32. +++ b/src/gd_io_dp.c
  33. @@ -292,6 +292,10 @@ static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len)
  34. rlen = dp->realSize - dp->pos;
  35. }
  36. + if (rlen < 0) {
  37. + return 0;
  38. + }
  39. +
  40. memcpy(buf, (void *) ((char *)dp->data + dp->pos), rlen);
  41. dp->pos += rlen;