OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.9 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../uclibc/pkg_patch/sed-4.1.4-malloc.patch
  5. # Copyright (C) 2006 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This patch file is dual-licensed. It is available under the license the
  11. # patched project is licensed under, as long as it is an OpenSource license
  12. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  13. # of the GNU General Public License as published by the Free Software
  14. # Foundation; either version 2 of the License, or (at your option) any later
  15. # version.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. Source:
  18. http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00112.html
  19. Bug Report: sed-4.1.4 misinterprets uClibc's malloc (patch included)
  20. From: Yuri Vasilevski
  21. Subject: Bug Report: sed-4.1.4 misinterprets uClibc's malloc (patch included)
  22. Date: Tue, 23 Aug 2005 23:17:40 -0500
  23. Hi,
  24. Recent versions of sed expect glibc behavior form malloc, i.e.
  25. malloc(0) return live pointer. This is not true for uClibc (and many
  26. other old/classical libc implementations).
  27. So I made and attach a patch to solve this problem. It basically makes
  28. re_node_set_alloc(set,0) behave exactly as re_node_set_init_empty(set).
  29. Yuri.
  30. diff -Naur sed-4.1.4.orig/lib/regex_internal.c sed-4.1.4/lib/regex_internal.c
  31. --- sed-4.1.4.orig/lib/regex_internal.c 2005-01-28 09:07:56 +0000
  32. +++ sed-4.1.4/lib/regex_internal.c 2005-08-24 03:20:28 +0000
  33. @@ -885,8 +885,9 @@
  34. {
  35. set->alloc = size;
  36. set->nelem = 0;
  37. - set->elems = re_malloc (int, size);
  38. - if (BE (set->elems == NULL, 0))
  39. + set->elems = re_malloc (int, size); /* can be NULL if size == 0
  40. + (see re_node_set_init_empty(set)) */
  41. + if (BE (set->elems == NULL && size != 0, 0))
  42. return REG_ESPACE;
  43. return REG_NOERROR;
  44. }