Bug 25322 - regex mishandles back-references inside interval expressions
Summary: regex mishandles back-references inside interval expressions
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: regex (show other bugs)
Version: 2.30
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-29 20:35 UTC by eggert
Modified: 2022-11-02 10:07 UTC (History)
54 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
C program illustrating bug with back-references inside intervals (151 bytes, text/x-csrc)
2019-12-29 20:35 UTC, eggert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description eggert 2019-12-29 20:35:01 UTC
Created attachment 12153 [details]
C program illustrating bug with back-references inside intervals

The glibc regular expression code mishandles regular expressions such as:

   .*((.)\2){2}$

as it does not backtrack enough to find a match that satisfies the back-references when they are used twice.

To reproduce the problem, compile and run the attached file backrefbug.c. It will exit with status 2, whereas the correct exit status is 0.

This bug was originally reported against GNU 'grep' here:

https://bugs.gnu.org/26864

and you can find more test cases by reading that bug report.
Comment 1 Ahmed Sayeed 2021-05-25 19:52:12 UTC Comment hidden (spam)
Comment 2 Leslie Brown 2021-06-15 23:40:15 UTC Comment hidden (spam)
Comment 3 Ahmed Sayeed 2021-06-27 17:41:02 UTC Comment hidden (spam)
Comment 4 lisa ray 2021-07-07 13:08:56 UTC Comment hidden (spam)
Comment 5 lisa ray 2021-07-07 13:48:58 UTC Comment hidden (spam)
Comment 8 Joe Anderson 2021-07-13 00:17:55 UTC Comment hidden (spam)
Comment 9 Sherry 2021-07-15 01:14:47 UTC Comment hidden (spam)
Comment 10 goda omar 2021-07-16 13:50:01 UTC Comment hidden (spam)
Comment 11 goda omar 2021-07-16 13:51:34 UTC Comment hidden (spam)
Comment 12 goda omar 2021-07-16 13:52:05 UTC Comment hidden (spam)
Comment 15 Sherry 2021-07-21 03:36:01 UTC Comment hidden (spam)
Comment 18 bh ta 2021-07-24 02:36:16 UTC Comment hidden (spam)
Comment 19 lisa ray 2021-07-25 08:36:01 UTC Comment hidden (spam)
Comment 21 Linda 2021-07-28 07:24:55 UTC Comment hidden (spam)
Comment 24 So Sánh Giá 2021-08-07 09:55:58 UTC Comment hidden (spam)
Comment 26 Madison Wilson 2021-08-09 09:33:20 UTC Comment hidden (spam)
Comment 27 contact 2021-08-09 17:13:21 UTC Comment hidden (spam)
Comment 30 Tamal32 2021-08-11 14:33:49 UTC Comment hidden (spam)
Comment 31 Patel 2021-08-12 02:04:38 UTC Comment hidden (spam)
Comment 32 Patel 2021-08-12 02:06:38 UTC Comment hidden (spam)
Comment 33 Ucel Sani 2021-08-19 05:54:16 UTC Comment hidden (spam)
Comment 34 Chris James 2021-08-23 04:59:16 UTC Comment hidden (spam)
Comment 35 ribevi 2021-08-27 17:55:42 UTC Comment hidden (spam)
Comment 36 Buran Levent 2021-08-28 18:31:01 UTC Comment hidden (spam)
Comment 37 shirtwell 2021-09-01 03:21:01 UTC Comment hidden (spam)
Comment 38 yahoups 2021-09-02 09:02:09 UTC Comment hidden (spam)
Comment 40 Mehmet gelisin 2021-09-10 19:40:55 UTC Comment hidden (spam)
Comment 41 Jari Littlenen 2021-09-14 12:54:29 UTC Comment hidden (spam)
Comment 42 johnb6174 2021-09-14 17:25:18 UTC Comment hidden (spam)
Comment 43 johnb6174 2021-09-14 17:26:13 UTC Comment hidden (spam)
Comment 44 johnb6174 2021-09-14 17:27:25 UTC Comment hidden (spam)
Comment 45 DeRace 2021-09-16 08:18:35 UTC Comment hidden (spam)
Comment 48 Frankdecender 2021-09-25 10:21:48 UTC Comment hidden (spam)
Comment 49 Frankdecender 2021-09-25 10:29:06 UTC Comment hidden (spam)
Comment 50 Frankdecender 2021-09-25 10:38:13 UTC Comment hidden (spam)
Comment 51 Frankdecender 2021-09-25 10:42:46 UTC Comment hidden (spam)
Comment 52 Chris James 2021-09-28 01:22:53 UTC Comment hidden (spam)
Comment 53 Yuan 2021-09-30 09:18:47 UTC Comment hidden (spam)
Comment 54 Y Khoa Blog 2021-10-01 02:45:11 UTC Comment hidden (spam)
Comment 55 Terry Shaw 2021-10-02 14:45:02 UTC Comment hidden (spam)
Comment 56 Portland Junk Removal Service 2021-10-04 19:45:06 UTC Comment hidden (spam)
Comment 57 David Montoya 2021-10-04 22:55:29 UTC Comment hidden (spam)
Comment 58 Erica Cruz 2021-10-08 06:59:28 UTC Comment hidden (spam)
Comment 59 Gulsen Engin 2021-10-09 11:00:12 UTC Comment hidden (spam)
Comment 60 noor 2021-10-14 08:49:59 UTC Comment hidden (spam)
Comment 61 noor 2021-10-14 08:51:04 UTC Comment hidden (spam)
Comment 64 Canerkin 2021-10-18 19:57:53 UTC Comment hidden (spam)
Comment 65 progonsaytu 2021-10-19 07:15:09 UTC Comment hidden (spam)
Comment 66 yaoltreza 2021-10-21 06:55:58 UTC Comment hidden (spam)
Comment 67 yaoltreza 2021-10-21 06:56:36 UTC Comment hidden (spam)
Comment 68 Joyce 2021-10-22 13:43:40 UTC Comment hidden (spam)
Comment 70 fiteva 2021-10-23 13:45:20 UTC Comment hidden (spam)
Comment 71 glassmtech 2021-10-24 10:03:12 UTC Comment hidden (spam)
Comment 72 glassmtech 2021-10-24 10:03:50 UTC Comment hidden (spam)
Comment 73 Nathan 2021-10-26 15:52:33 UTC Comment hidden (spam)
Comment 74 Paulo 2021-10-29 07:30:05 UTC Comment hidden (spam)
Comment 75 Kuka Kim 2021-10-29 10:56:59 UTC Comment hidden (spam)
Comment 76 jaj058080 2021-11-02 08:00:48 UTC Comment hidden (spam)
Comment 77 paneki 2021-11-06 21:11:20 UTC Comment hidden (spam)
Comment 78 tesaso8237@funboxcn.com 2021-11-13 19:30:37 UTC Comment hidden (spam)
Comment 79 Scorpia 2021-11-25 11:28:51 UTC Comment hidden (spam)
Comment 80 bh ta 2022-11-02 10:07:09 UTC Comment hidden (spam)