Panic on some regex #3

Closed
opened 2023-07-26 04:54:03 +00:00 by Ghost · 4 comments
import (
	"go.arsenm.dev/pcre"
	"testing"
)

func TestRegex(t *testing.T) {
	regex := pcre.MustCompile(`varnish(?: \(Varnish\/([\d.]{1,250})\))?`)
	regex.FindStringSubmatch("1.1 varnish")
}

=== RUN TestRegex
--- FAIL: TestRegex (209.38s)
panic: runtime error: slice bounds out of range [:18446744073709551615] with capacity 16 [recovered]
panic: runtime error: slice bounds out of range [:18446744073709551615] with capacity 16

r.match returns an invalid array
image

```go import ( "go.arsenm.dev/pcre" "testing" ) func TestRegex(t *testing.T) { regex := pcre.MustCompile(`varnish(?: \(Varnish\/([\d.]{1,250})\))?`) regex.FindStringSubmatch("1.1 varnish") } ``` === RUN TestRegex --- FAIL: TestRegex (209.38s) panic: runtime error: slice bounds out of range [:18446744073709551615] with capacity 16 [recovered] panic: runtime error: slice bounds out of range [:18446744073709551615] with capacity 16 `r.match` returns an invalid array ![image](/attachments/fe2dd63f-bc9a-4e5c-bf95-564965bede84)
Owner

This should be fixed in 6d906d55a6. Can you please test it and let me know if it works?

This should be fixed in 6d906d55a6d26dfab6d7ecf76b01acdd2caa124f. Can you please test it and let me know if it works?
Author

@Elara6331 It works! Thank you!

@Elara6331 It works! Thank you!
Ghost closed this issue 2023-07-26 07:24:28 +00:00
Owner

@singee Can I add your example as a test case to avoid a regression?

@singee Can I add your example as a test case to avoid a regression?
Author

@Elara6331 Sure, of course!

@Elara6331 Sure, of course!
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Elara6331/pcre#3
No description provided.