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

stack underflow from func call #14546

Open
p5pRT opened this issue Feb 28, 2015 · 3 comments
Open

stack underflow from func call #14546

p5pRT opened this issue Feb 28, 2015 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 28, 2015

Migrated from rt.perl.org#123951 (status was 'open')

Searchable as RT123951$

@p5pRT
Copy link
Author

p5pRT commented Feb 28, 2015

From @hvds

AFL (<http​://lcamtuf.coredump.cx/afl/>) finds this​:

% /miniperl -e '&{0 == &{0 == 0}} * 0'
Segmentation fault (core dumped)
%

Running with -Ds shows a stack underflow - the multiply is just a way to show it​:

% ./miniperl -e '$^D="st"; &{0 == &{0 == 0}}'
  => PVMG("st"\0)
(-e​:1) nextstate
  =>
(-e​:1) pushmark
  => *
(-e​:1) const(IV(0))
  => * IV(0)
(-e​:1) pushmark
  => * IV(0) *
(-e​:1) const(SV_YES)
  => * IV(0) * SV_YES
(-e​:1) entersub
  => * IV(0)
(-e​:1) eq
  => [STACK UNDERFLOW!!!]
*
(-e​:1) entersub
  => [STACK UNDERFLOW!!!]

(-e​:1) leave
%

I'm unlikely to have time for further debugging on this one any time soon.

Hugo

@p5pRT
Copy link
Author

p5pRT commented Mar 1, 2015

From @cpansprout

On Sat Feb 28 03​:46​:02 2015, hv wrote​:

AFL (<http​://lcamtuf.coredump.cx/afl/>) finds this​:

% /miniperl -e '&{0 == &{0 == 0}} * 0'
Segmentation fault (core dumped)
%

Running with -Ds shows a stack underflow - the multiply is just a way
to show it​:

% ./miniperl -e '$^D="st"; &{0 == &{0 == 0}}'
=> PVMG("st"\0)
(-e​:1) nextstate
=>
(-e​:1) pushmark
=> *
(-e​:1) const(IV(0))
=> * IV(0)
(-e​:1) pushmark
=> * IV(0) *
(-e​:1) const(SV_YES)
=> * IV(0) * SV_YES
(-e​:1) entersub
=> * IV(0)
(-e​:1) eq
=> [STACK UNDERFLOW!!!]
*
(-e​:1) entersub
=> [STACK UNDERFLOW!!!]

(-e​:1) leave
%

I'm unlikely to have time for further debugging on this one any time
soon.

I find this clearer​:

$ ./miniperl -e 'warn 1, 2, 3, &{0 == 0} * 0, 4, 5, 6'
120456 at -e line 1.

This has something to do with the &PL_sv_yes-as-a-sub hack, which is used to implement missing ->import methods. That this was ever exposed to Perl space is a bug, IMHO, though we have explicit tests for it.

However, it is not limited to &{0 == 0}​:

$ ./miniperl -e 'warn 1, 2, 3, main->import * 0, 4, 5, 6'
120456 at -e line 1.

I see the same results with 5.8.7 and blead.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Mar 1, 2015

The RT System itself - Status changed from 'new' to 'open'

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

2 participants