bug-glibc
[Top][All Lists]
Advanced

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

re_search does not find match


From: Patrick Smith
Subject: re_search does not find match
Date: Tue, 04 Feb 2003 01:11:05 -0500
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.2.1) Gecko/20030113

>Submitter-Id:  net
>Originator:    Patrick Smith
>Organization:
 None
>Confidential:  no
>Synopsis:      re_search does not find match
>Severity:      serious
>Priority:      medium
>Category:      libc
>Class:         sw-bug
>Release:       libc-2.3.1
>Environment:

Host type: powerpc-unknown-linux-gnu
System: Linux mimsy 2.4.20 #1 Mon Jan 13 09:31:26 EST 2003 ppc unknown
Architecture: ppc

Addons: linuxthreads

Build CC: gcc
Compiler version: 3.2.1
Kernel headers: 2.4.20
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: yes

>Description:

This problem was exposed by the test suite for GNU grep 2.5.1.

When given a particular regular expression, and a string that matches that expression, re_search reports "no match". Specifically, the enclosed small program prints -1; it should print 0.

Stepan Kasal adds: "If you copy posix/reg* from current GNU libc CVS and compile grep 2.5.1, the resulting grep program doesn't return 1, it simply hangs."

>How-To-Repeat:

#include <stdlib.h>
#include <sys/types.h>
#include <regex.h>
#include <stdio.h>
#include <string.h>

struct re_pattern_buffer zap;

int main()
{
   struct re_pattern_buffer pattern;
   char ptrn[] =

"^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$";
   char stack[] = "civic";

   re_syntax_options = RE_SYNTAX_EGREP;

   memcpy(&pattern, &zap, sizeof(pattern));
   if (re_compile_pattern(ptrn, sizeof(ptrn)-1, &pattern) != 0) {
      printf("re_compile failed\n");
      return 0;
   }

   printf("%d\n",
         re_search(&pattern, stack, sizeof(stack)-1, 0, sizeof(stack)-1, 0)
         );
   return 0;
}

>Fix:






reply via email to

[Prev in Thread] Current Thread [Next in Thread]