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

regexp: slice bounds out of range #11176

Closed
dvyukov opened this issue Jun 11, 2015 · 1 comment
Closed

regexp: slice bounds out of range #11176

dvyukov opened this issue Jun 11, 2015 · 1 comment
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jun 11, 2015

The following program crashes with the panic:

package main

import "regexp"

func main() {
    regexp.MustCompile("((0(0){0}))").ReplaceAllString("00000", "00$00")
}
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
regexp.(*machine).backtrack(0xc2080b2120, 0x7f6c00256050, 0xc2080b21f8, 0x0, 0x5, 0x8, 0x0)
    src/regexp/backtrack.go:326 +0x3c6
regexp.(*Regexp).doExecute(0xc2080b6000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4be260, 0x5, 0x0, 0x8, ...)
    src/regexp/exec.go:449 +0x423
regexp.(*Regexp).replaceAll(0xc2080b6000, 0x0, 0x0, 0x0, 0x4be260, 0x5, 0x8, 0xc20807ded8, 0x0, 0x0, ...)
    src/regexp/regexp.go:486 +0xf8
regexp.(*Regexp).ReplaceAllString(0xc2080b6000, 0x4be260, 0x5, 0x4be240, 0x5, 0x0, 0x0)
    src/regexp/regexp.go:449 +0x107
main.main()
    regexp.go:6 +0x64

go version devel +b0532a9 Mon Jun 8 05:13:15 2015 +0000 linux/amd64

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jun 11, 2015
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/14013 mentions this issue.

@rsc rsc closed this as completed in f75f2f3 Oct 23, 2015
@golang golang locked and limited conversation to collaborators Oct 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants