public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix bug-regex4
@ 2003-04-07 21:13 Jakub Jelinek
  2003-04-08  1:23 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2003-04-07 21:13 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers

Hi!

If range and/or stop arguments to re_search_2 are too large, re_search_2
might search beyond end of buffer.

2003-04-07  Jakub Jelinek  <jakub@redhat.com>

	* posix/bug-regex4.c (main): Cap range and stop arguments to
	sum of size1 and size2 arguments.

--- libc/posix/bug-regex4.c.jj	2002-07-29 09:14:54.000000000 -0400
+++ libc/posix/bug-regex4.c	2003-04-07 17:04:31.000000000 -0400
@@ -43,9 +43,9 @@ main (void)
     }
   else
     {
-      match[0] = re_search_2 (&regex, "xyabez", 6, "", 0, 1, 9, NULL, 10);
+      match[0] = re_search_2 (&regex, "xyabez", 6, "", 0, 1, 5, NULL, 6);
       match[1] = re_search_2 (&regex, NULL, 0, "abc", 3, 0, 3, NULL, 3);
-      match[2] = re_search_2 (&regex, "xya", 3, "bd", 2, 2, 6, NULL, 8);
+      match[2] = re_search_2 (&regex, "xya", 3, "bd", 2, 2, 3, NULL, 5);
       if (match[0] != 2 || match[1] != 0 || match[2] != 2)
 	{
 	  printf ("re_search_2 returned %d,%d,%d, expected 2,0,2\n",

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix bug-regex4
  2003-04-07 21:13 [PATCH] Fix bug-regex4 Jakub Jelinek
@ 2003-04-08  1:23 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2003-04-08  1:23 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers

> 2003-04-07  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* posix/bug-regex4.c (main): Cap range and stop arguments to
> 	sum of size1 and size2 arguments.

Thanks, I put this in.


Roland

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-08  1:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-07 21:13 [PATCH] Fix bug-regex4 Jakub Jelinek
2003-04-08  1:23 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).