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

Issue loading many regex'es #64

Closed
iuyiuy opened this Issue Sep 12, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@iuyiuy

iuyiuy commented Sep 12, 2017

This might be related to issue #14, but i'm not sure, since i wasn't able to reproduce it with the command given in that bug report.

I managed to make a test case which consistently worked when creating 125 regex'es and didn't work with 126 (keep in mind that i ran set +H in bash, so the exclamation marks will work as intended here):

kbj@kbj-dev ~ $ for i in `seq 1 125`; do echo -e "$i:\n  asd: !!perl/regexp (?^u:^qweqwe$)"; done > /tmp/test.yaml; perl -MData::Dumper -MYAML::XS -e 'die Dumper(YAML::XS::LoadFile("/tmp/test.yaml"))' 2>&1 | head
$VAR1 = {
          '123' => {
                     'asd' => qr/(?^u:^qweqwe$)/u
                   },
          '52' => {
                    'asd' => qr/(?^u:^qweqwe$)/u
                  },
          '112' => {
                     'asd' => qr/(?^u:^qweqwe$)/u
                   },
kbj@kbj-dev ~ $ for i in `seq 1 126`; do echo -e "$i:\n  asd: !!perl/regexp (?^u:^qweqwe$)"; done > /tmp/test.yaml; perl -MData::Dumper -MYAML::XS -e 'die Dumper(YAML::XS::LoadFile("/tmp/test.yaml"))' 2>&1 | head
panic: memory wrap at -e line 1.

This is with perl v5.20.2, if that makes a difference. I was also able to make a yaml file with 123k regex'es, which apparently worked:

kbj@kbj-dev ~ $ perl -MData::Dumper -MYAML::XS -e 'die Dumper(YAML::XS::Load(join("",map {$_.":\n asd:\n  !!perl/regexp (?^u:^qweqwe\$)\n"} 1..123000)))' 2>&1 | head
$VAR1 = {
          '68035' => {
                       'asd' => qr/(?^u:^qweqwe$)/u
                     },
          '82639' => {
                       'asd' => qr/(?^u:^qweqwe$)/u
                     },
          '100609' => {
                        'asd' => qr/(?^u:^qweqwe$)/u
                      },
@perlpunk

This comment has been minimized.

Show comment
Hide comment
@perlpunk

perlpunk Dec 16, 2017

Collaborator

Thanks for the report.
Reproduced on 5.24.1

Collaborator

perlpunk commented Dec 16, 2017

Thanks for the report.
Reproduced on 5.24.1

perlpunk added a commit that referenced this issue Dec 16, 2017

Fix error (corrupted stack) when loading regexes
Error was: panic: memory wrap

This is a fix for issue #64

See perldoc perlcall
@perlpunk

This comment has been minimized.

Show comment
Hide comment
@perlpunk

perlpunk Dec 16, 2017

Collaborator

This should be fixed by PR #71
Thanks again!

Collaborator

perlpunk commented Dec 16, 2017

This should be fixed by PR #71
Thanks again!

@perlpunk

This comment has been minimized.

Show comment
Hide comment
@perlpunk

perlpunk Dec 16, 2017

Collaborator

Released YAML::LibYAML 0.67_001

Collaborator

perlpunk commented Dec 16, 2017

Released YAML::LibYAML 0.67_001

@perlpunk perlpunk closed this Dec 16, 2017

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Apr 3, 2018

dev-perl/YAML-LibYAML: Bump to version 0.690.0
Upstream:
- (Security) Add $LoadBlessed option[1] to run on/off loading objects
- Fix regex roundtrip [2]
- Fix loading of many regex classes [3]
- Support tags !!str, !!map and !!seq [4]
- Support JSON::PP::Boolean via $YAML::XS::Boolean [5]
- Fix Dump modifying inspected values [6]

[1]
Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=861958
Bug: ingydotnet/yaml-libyaml-pm#45
Bug: ingydotnet/yaml-libyaml-pm#73
Bug: ingydotnet/yaml-libyaml-pm#74
[2]
Bug: ingydotnet/yaml-libyaml-pm#69
Bug: ingydotnet/yaml-libyaml-pm#70
[3]
Bug: ingydotnet/yaml-libyaml-pm#64
Bug: ingydotnet/yaml-libyaml-pm#71
[4]
Bug: ingydotnet/yaml-libyaml-pm#67
[5]
Bug: ingydotnet/yaml-libyaml-pm#66
[6]
Bug: ingydotnet/yaml-libyaml-pm#32
Bug: ingydotnet/yaml-libyaml-pm#55
Package-Manager: Portage-2.3.24, Repoman-2.3.6

madmartin added a commit to madmartin/gentoo that referenced this issue Apr 4, 2018

dev-perl/YAML-LibYAML: Bump to version 0.690.0
Upstream:
- (Security) Add $LoadBlessed option[1] to run on/off loading objects
- Fix regex roundtrip [2]
- Fix loading of many regex classes [3]
- Support tags !!str, !!map and !!seq [4]
- Support JSON::PP::Boolean via $YAML::XS::Boolean [5]
- Fix Dump modifying inspected values [6]

[1]
Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=861958
Bug: ingydotnet/yaml-libyaml-pm#45
Bug: ingydotnet/yaml-libyaml-pm#73
Bug: ingydotnet/yaml-libyaml-pm#74
[2]
Bug: ingydotnet/yaml-libyaml-pm#69
Bug: ingydotnet/yaml-libyaml-pm#70
[3]
Bug: ingydotnet/yaml-libyaml-pm#64
Bug: ingydotnet/yaml-libyaml-pm#71
[4]
Bug: ingydotnet/yaml-libyaml-pm#67
[5]
Bug: ingydotnet/yaml-libyaml-pm#66
[6]
Bug: ingydotnet/yaml-libyaml-pm#32
Bug: ingydotnet/yaml-libyaml-pm#55
Package-Manager: Portage-2.3.24, Repoman-2.3.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment