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

fix for several sre escaping bugs (fixes #776311) #40840

Closed
mkc mannequin opened this issue Aug 29, 2004 · 6 comments
Closed

fix for several sre escaping bugs (fixes #776311) #40840

mkc mannequin opened this issue Aug 29, 2004 · 6 comments
Labels
stdlib Python modules in the Lib dir

Comments

@mkc
Copy link
Mannequin

mkc mannequin commented Aug 29, 2004

BPO 1018386
Nosy @loewis
Files
  • mkc-patch.gz: the patch
  • sre.patch: Applied patch.
  • 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 2004-09-03.20:19:06.000>
    created_at = <Date 2004-08-29.00:19:07.000>
    labels = ['library']
    title = 'fix for several sre escaping bugs (fixes python/cpython#38919)'
    updated_at = <Date 2004-09-03.20:19:06.000>
    user = 'https://bugs.python.org/mkc'

    bugs.python.org fields:

    activity = <Date 2004-09-03.20:19:06.000>
    actor = 'niemeyer'
    assignee = 'niemeyer'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2004-08-29.00:19:07.000>
    creator = 'mkc'
    dependencies = []
    files = ['6224', '6225']
    hgrepos = []
    issue_num = 1018386
    keywords = ['patch']
    message_count = 6.0
    messages = ['46801', '46802', '46803', '46804', '46805', '46806']
    nosy_count = 3.0
    nosy_names = ['loewis', 'niemeyer', 'mkc']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1018386'
    versions = ['Python 2.4']

    @mkc
    Copy link
    Mannequin Author

    mkc mannequin commented Aug 29, 2004

    This patch fixes a number of escaping bugs in sre (the
    re module). The most serious is an infinite loop in
    the parser, which is what the submitter of bug bpo-776311
    was seeing. Another allows octal escapes to have an
    arbitrary number of digits--the doc didn't quite
    exclude this, but it's clearly the wrong thing (cf.
    string literals). There are others--see the test cases.

    @mkc mkc mannequin closed this as completed Aug 29, 2004
    @mkc mkc mannequin assigned niemeyer Aug 29, 2004
    @mkc mkc mannequin added the stdlib Python modules in the Lib dir label Aug 29, 2004
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Aug 29, 2004

    Logged In: YES
    user_id=21627

    Gustavo, can you take a look? If not, please unassign.

    @niemeyer
    Copy link
    Mannequin

    niemeyer mannequin commented Sep 2, 2004

    Logged In: YES
    user_id=7887

    Of course! I'll be reviewing it offline and get back shortly.

    Thanks for assigning it to me!

    @niemeyer
    Copy link
    Mannequin

    niemeyer mannequin commented Sep 3, 2004

    Logged In: YES
    user_id=7887

    Applied as:

    Lib/sre_parse.py: 1.62
    Lib/test/test_re.py: 1.51
    Doc/lib/libre.tex: 1.109

    It was a little bit modified to adapt to the current CVS version.

    I've also reimplemented the logic of numeric escaping with a logic
    similar to what is used in _escape() function, making it a little bit
    faster and removing the need for the external function.

    I'm attaching the applied patch for reference. Please, let me know if
    you have any comments.

    Thanks a lot for the patch!

    @mkc
    Copy link
    Mannequin Author

    mkc mannequin commented Sep 3, 2004

    Logged In: YES
    user_id=555

    Gustavo, it looks better than my patch.

    Two very minor comments:

    • The s/wildcare/wildcard/ fix to _sre.c got dropped?

    • In this expression, you're checking the first digit, then
      the third, then the second. I'd check them in order, for
      readability.

       c in OCTDIGITS and s.next in OCTDIGITS and this[2] in
      

    OCTDIGITS

    As I said, very minor. Thanks for the quick review/apply!

    @niemeyer
    Copy link
    Mannequin

    niemeyer mannequin commented Sep 3, 2004

    Logged In: YES
    user_id=7887

    I included the comment typo fix on _sre.c into another patch I had
    to apply. Sorry for not mentioning it.

    I just reordered these entries as you suggested.

    Thanks again!

    @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
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants