[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r1069 - glibc-package/trunk/debian/patches



Author: pb
Date: 2005-12-25 20:26:01 +0000 (Sun, 25 Dec 2005)
New Revision: 1069

Added:
   glibc-package/trunk/debian/patches/strfry-segv.dpatch
Log:
actually add strfry patch



Added: glibc-package/trunk/debian/patches/strfry-segv.dpatch
===================================================================
--- glibc-package/trunk/debian/patches/strfry-segv.dpatch	2005-12-25 20:25:30 UTC (rev 1068)
+++ glibc-package/trunk/debian/patches/strfry-segv.dpatch	2005-12-25 20:26:01 UTC (rev 1069)
@@ -0,0 +1,124 @@
+#! /bin/sh -e
+
+# DP: Fix segfault in strfry()
+
+if [ $# -ne 2 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+    -patch) patch -d "$2" -f --no-backup-if-mismatch -p0 < $0;;
+    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p0 < $0;;
+    *)
+        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+        exit 1
+esac
+exit 0
+
+2005-04-12  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1090]
+	* stdlib/random_r.c (__initstate_r): Don't use non-existing state.
+	* string/tst-strfry.c: New file.
+	* string/Makefile (tests): Add tst-strfry.
+
+Index: stdlib/random_r.c
+===================================================================
+RCS file: /cvs/glibc/libc/stdlib/random_r.c,v
+retrieving revision 1.19
+retrieving revision 1.20
+diff -u -r1.19 -r1.20
+--- stdlib/random_r.c	10 Feb 2005 09:40:11 -0000	1.19
++++ stdlib/random_r.c	12 Apr 2005 15:21:29 -0000	1.20
+@@ -236,23 +236,20 @@
+      size_t n;
+      struct random_data *buf;
+ {
+-  int type;
+-  int degree;
+-  int separation;
+-  int32_t *state;
+-  int old_type;
+-  int32_t *old_state;
+-
+   if (buf == NULL)
+     goto fail;
+ 
+-  old_type = buf->rand_type;
+-  old_state = buf->state;
+-  if (old_type == TYPE_0)
+-    old_state[-1] = TYPE_0;
+-  else
+-    old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
++  int32_t *old_state = buf->state;
++  if (old_state != NULL)
++    {
++      int old_type = buf->rand_type;
++      if (old_type == TYPE_0)
++	old_state[-1] = TYPE_0;
++      else
++	old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
++    }
+ 
++  int type;
+   if (n >= BREAK_3)
+     type = n < BREAK_4 ? TYPE_3 : TYPE_4;
+   else if (n < BREAK_1)
+@@ -267,13 +264,13 @@
+   else
+     type = n < BREAK_2 ? TYPE_1 : TYPE_2;
+ 
+-  degree = random_poly_info.degrees[type];
+-  separation = random_poly_info.seps[type];
++  int degree = random_poly_info.degrees[type];
++  int separation = random_poly_info.seps[type];
+ 
+   buf->rand_type = type;
+   buf->rand_sep = separation;
+   buf->rand_deg = degree;
+-  state = &((int32_t *) arg_state)[1];	/* First location.  */
++  int32_t *state = &((int32_t *) arg_state)[1];	/* First location.  */
+   /* Must set END_PTR before srandom.  */
+   buf->end_ptr = &state[degree];
+ 
+--- /dev/null	2005-04-18 14:50:08.963492000 +0100
++++ string/tst-strfry.c	2005-04-12 16:27:40.000000000 +0100
+@@ -0,0 +1,15 @@
++#include <stdio.h>
++#include <string.h>
++
++static int
++do_test (void)
++{
++  char str[] = "this is a test";
++
++  strfry (str);
++
++  return 0;
++}
++
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+Index: string/Makefile
+===================================================================
+RCS file: /cvs/glibc/libc/string/Makefile,v
+retrieving revision 1.65
+retrieving revision 1.66
+diff -u -r1.65 -r1.66
+--- string/Makefile	18 Oct 2004 04:17:12 -0000	1.65
++++ string/Makefile	12 Apr 2005 15:27:59 -0000	1.66
+@@ -1,4 +1,4 @@
+-# Copyright (C) 1991-1999,2000,2001,2002 Free Software Foundation, Inc.
++# Copyright (C) 1991-1999,2000,2001,2002, 2005 Free Software Foundation, Inc.
+ # This file is part of the GNU C Library.
+ 
+ # The GNU C Library is free software; you can redistribute it and/or
+@@ -52,7 +52,7 @@
+ tests		:= tester inl-tester noinl-tester testcopy test-ffs	\
+ 		   tst-strlen stratcliff tst-svc tst-inlcall		\
+ 		   bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap	\
+-		   tst-strtok tst-strxfrm bug-strcoll1			\
++		   tst-strtok tst-strxfrm bug-strcoll1 tst-strfry	\
+ 		   $(addprefix test-,$(strop-tests))
+ distribute	:= memcopy.h pagecopy.h tst-svc.expect test-string.h
+ 


Property changes on: glibc-package/trunk/debian/patches/strfry-segv.dpatch
___________________________________________________________________
Name: svn:executable
   + *



Reply to: