File: bug-regex15.c

package info (click to toggle)
glibc 2.29-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 271,612 kB
  • sloc: ansic: 1,013,574; asm: 261,303; makefile: 11,428; sh: 10,300; python: 8,944; cpp: 5,062; awk: 1,956; perl: 514; yacc: 290; pascal: 182; sed: 73
file content (32 lines) | stat: -rw-r--r-- 593 bytes parent folder | download | duplicates (31)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Test for memory/CPU leak in regcomp.  */

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

#define TEST_DATA_LIMIT (32 << 20)

static int do_test (void);
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"

static int
do_test (void)
{
  regex_t re;
  int reerr;

  reerr = regcomp (&re, "^6?3?[25]?5?[14]*[25]*[69]*+[58]*87?4?$",
		   REG_EXTENDED | REG_NOSUB);
  if (reerr != 0)
    {
      char buf[100];
      regerror (reerr, &re, buf, sizeof buf);
      printf ("regerror %s\n", buf);
      return 1;
    }

  return 0;
}