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

Julia Regex Bug? #12663

Closed
hnkchnsk opened this issue Aug 17, 2015 · 4 comments
Closed

Julia Regex Bug? #12663

hnkchnsk opened this issue Aug 17, 2015 · 4 comments

Comments

@hnkchnsk
Copy link

Hi all,

sadly I opened this in the wrong place: http://discuss.junolab.org/t/julia-regex-bug-not-sure-as-i-am-new-to-julia/288

In short, I am new to julia, but I think this is a bug and not me messing up program logic:

c=0
for i in 1:1:100000

    a=rand(1:10, 100)   
    b=""
    for number in a
        if number == 1
        b=b * "A"
        else b=b * "B"
        end

    end

    if ismatch(r".*A.*A.*A.*A.*A.*A.*A.*A.*A.*A.*A.*A.*A.*A.*A.*A.*A.*A.*A", b)
    c = c + 1
    end

end

print("Result: ")
print(c/100000)

I use this to estimate some statistical stuff. I had it working in other languages (even in bash ;-), but not that blazingly fast as in julia - I have it working without regex, using numbers.

Yet with the regex julia comes up with an error after some seconds:

ERROR: error -8
 in error at error.jl:21
 in exec at ./pcre.jl:149
 in ismatch at ./regex.jl:106
 in anonymous at no file:13

I checked, the BBBABBBBBA...-stuff is created as expected, c counts up to something between 0 and 75 before I hit this regex error.

Tested on julia version 0.2.1 and 0.3.11.

Kind regards

hnk

@stevengj
Copy link
Member

I can reproduce the problem in Julia 0.3.8, but the code runs successfully in Julia 0.4.

@malmaud, could this have been fixed by the transition to PCRE2 (#11447), or by one of the other PCRE version bumps?

@tkelman
Copy link
Contributor

tkelman commented Aug 17, 2015

Note that due to #11577 we shouldn't upgrade release-0.3 to any of 8.34, 8.35, 8.36, 8.37 without patches for the buffer overflow. 10.20 has the fix for that but might be too large of a change to backport.

@malmaud
Copy link
Contributor

malmaud commented Aug 17, 2015

Mmm, I have no special insight into what's going wrong. I don't recall any
of the pcre release notes mentioning patching something like this, but I
could have missed it.
On Mon, Aug 17, 2015 at 4:37 PM Tony Kelman [email protected]
wrote:

Note that due to #11577 #11577
we shouldn't upgrade release-0.3 to any of 8.34, 8.35, 8.36, 8.37 without
patches for the buffer overflow. 10.20 has the fix for that but might be
too large of a change to backport.


Reply to this email directly or view it on GitHub
#12663 (comment).

@JeffBezanson
Copy link
Member

Fixed in 0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants