Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provoking infinite scanner loops #36890

Closed
tim-one opened this issue Jul 13, 2002 · 4 comments
Closed

Provoking infinite scanner loops #36890

tim-one opened this issue Jul 13, 2002 · 4 comments

Comments

@tim-one
Copy link
Member

tim-one commented Jul 13, 2002

BPO 581080
Nosy @tim-one

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2003-04-22.21:30:02.000>
created_at = <Date 2002-07-13.19:32:52.000>
labels = ['expert-regex']
title = 'Provoking infinite scanner loops'
updated_at = <Date 2003-04-22.21:30:02.000>
user = 'https://github.com/tim-one'

bugs.python.org fields:

activity = <Date 2003-04-22.21:30:02.000>
actor = 'dschnepper'
assignee = 'effbot'
closed = True
closed_date = None
closer = None
components = ['Regular Expressions']
creation = <Date 2002-07-13.19:32:52.000>
creator = 'tim.peters'
dependencies = []
files = []
hgrepos = []
issue_num = 581080
keywords = []
message_count = 4.0
messages = ['11563', '11564', '11565', '11566']
nosy_count = 4.0
nosy_names = ['tim.peters', 'effbot', 'niemeyer', 'dschnepper']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue581080'
versions = []

@tim-one
Copy link
Member Author

tim-one commented Jul 13, 2002

From c.l.py:

"""
From: Jane Austine
Sent: Saturday, July 13, 2002 6:01 AM
To: python-list@python.org
Subject: sre.finditer break down: is this a bug?

Newly added function sre.finditer and
(matchedObject.)finditer break down and the system
crushes on win32 when requested for next() after
StopIteration.

see:

> import sre
> fi=sre.finditer(r'\s','a b')
> fi.next()
> fi.next()
> fi.next() #system halts for ever.
--
"""

The semantics of the underlying calliterobject aren't
clear to me in this endcase, and I've raised that issue
on c.l.py.

But regardless of how that's resolved, it's easy to
provoke the bad behavior without using finditer, and
that should be fixed:

>>> import re
>>> s = re.compile(r'\s').scanner
>>> t = s('a b').search
>>> t()
<_sre.SRE_Match object at 0x00679F70>
>>> t()
>>> t()
>>> t()

and there it's hung.

@tim-one
Copy link
Member Author

tim-one commented Jul 13, 2002

Logged In: YES
user_id=31435

Oops -- I meant I raised the calliterobject issue on Python-
Dev, not on c.l.py.

@niemeyer
Copy link
Mannequin

niemeyer mannequin commented Nov 7, 2002

Logged In: YES
user_id=7887

Fixed in the following CVS revisions:

Misc/NEWS: 1.515->1.516
Modules/_sre.c: 2.84->2.85

Thank you, Tim!

@dschnepper
Copy link
Mannequin

dschnepper mannequin commented Apr 22, 2003

Logged In: YES
user_id=72348

This fix needs backporting to the release-maint22 branch

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant