0003-avoid-malloc-poisoning-issue.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From 51a1dcaa6ed5713520dca36fc58cd9240c08b7ca Mon Sep 17 00:00:00 2001
  2. From: Even Rouault <even.rouault@spatialys.com>
  3. Date: Thu, 7 Sep 2017 17:52:59 +0200
  4. Subject: [PATCH] Avoid malloc poisoning issue when including <pthread.h> of
  5. uclibc (#1013)
  6. Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
  7. ---
  8. src/lib/openjp2/thread.c | 11 ++++++++---
  9. 1 file changed, 8 insertions(+), 3 deletions(-)
  10. diff --git a/src/lib/openjp2/thread.c b/src/lib/openjp2/thread.c
  11. index 8b56aa4d5..af33c2c80 100644
  12. --- a/src/lib/openjp2/thread.c
  13. +++ b/src/lib/openjp2/thread.c
  14. @@ -29,9 +29,6 @@
  15. * POSSIBILITY OF SUCH DAMAGE.
  16. */
  17. -#include "opj_includes.h"
  18. -
  19. -#include "thread.h"
  20. #include <assert.h>
  21. #ifdef MUTEX_win32
  22. @@ -46,6 +43,8 @@
  23. #include <windows.h>
  24. #include <process.h>
  25. +#include "opj_includes.h"
  26. +
  27. OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void)
  28. {
  29. return OPJ_TRUE;
  30. @@ -289,6 +288,10 @@ void opj_thread_join(opj_thread_t* thread)
  31. #include <stdlib.h>
  32. #include <unistd.h>
  33. +/* Moved after all system includes, and in particular pthread.h, so as to */
  34. +/* avoid poisoning issuing with malloc() use in pthread.h with ulibc (#1013) */
  35. +#include "opj_includes.h"
  36. +
  37. OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void)
  38. {
  39. return OPJ_TRUE;
  40. @@ -425,6 +428,8 @@ void opj_thread_join(opj_thread_t* thread)
  41. #else
  42. /* Stub implementation */
  43. +#include "opj_includes.h"
  44. +
  45. OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void)
  46. {
  47. return OPJ_FALSE;