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