Skip to content

sre bug: lastmark_save/restore #53380

Description

@arigo
mannequin
BPO 9134
Nosy @ezio-melotti, @serhiy-storchaka, @animalize, @tirkarthi
Files
  • x.py: Bug case
  • 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 = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2022-03-29.15:30:16.865>
    created_at = <Date 2010-06-30.21:18:56.596>
    labels = ['extension-modules', 'expert-regex', 'type-bug', '3.11']
    title = 'sre bug: lastmark_save/restore'
    updated_at = <Date 2022-03-29.15:30:16.864>
    user = 'https://github.com/arigo'

    bugs.python.org fields:

    activity = <Date 2022-03-29.15:30:16.864>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2022-03-29.15:30:16.865>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules', 'Regular Expressions']
    creation = <Date 2010-06-30.21:18:56.596>
    creator = 'arigo'
    dependencies = []
    files = ['17822']
    hgrepos = []
    issue_num = 9134
    keywords = []
    message_count = 5.0
    messages = ['109019', '109034', '224499', '224502', '416267']
    nosy_count = 5.0
    nosy_names = ['ezio.melotti', 'abacabadabacaba', 'serhiy.storchaka', 'malin', 'xtreak']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue9134'
    versions = ['Python 3.11']

    Activity

    1. arigo commented on Jun 30, 2010

      arigomannequin
      MannequinAuthor

      The re module is buggy is rare cases; see attached example script.

      The bug is caused by the macros LASTMARK_SAVE and LASTMARK_RESTORE which are sometimes used without the extra code that does if (state->repeat) {mark_save()/mark_restore()}.

      The bug appears by mis-reporting the position of groups within a repeated match (with * or +), notably the position of some groups that matched in older repetitions but (after some backtracking) not in newer ones.

    2. arigo commented on Jul 1, 2010

      arigomannequin
      MannequinAuthor

      It's pretty trivial to turn my x.py into a unit test, of course.

    3. serhiy-storchaka commented on Aug 1, 2014

      @serhiy-storchaka
      Member

      It looks as the nature of this bug is clear to you, Armin. Do you want to write a patch?

    4. arigo commented on Aug 1, 2014

      arigomannequin
      MannequinAuthor

      It was clear to me four years ago. Now I'd have to dig again as much as you do.

    5. serhiy-storchaka commented on Mar 29, 2022

      @serhiy-storchaka
      Member

      Fixed in bpo-35859 together with other bugs, but the fix was only applied to 3.11, because that bug is old and the old behavior matches the behavior in some other engines (Perl and Java).

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    3.11only security fixesextension-modulesC modules in the Modules dirtopic-regextype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions