You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucy.apache.org by "Nick Wellnhofer (JIRA)" <ji...@apache.org> on 2015/11/04 13:38:27 UTC

[lucy-issues] [jira] [Resolved] (CLOWNFISH-62) Crash when passing Perl variable as decremented arg

     [ https://issues.apache.org/jira/browse/CLOWNFISH-62?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Wellnhofer resolved CLOWNFISH-62.
--------------------------------------
       Resolution: Fixed
    Fix Version/s: 0.5.0

It turns out that my analysis was wrong. Decremented arguments were incref'd but the return value was discarded, breaking the copy-on-incref mechanism.

> Crash when passing Perl variable as decremented arg
> ---------------------------------------------------
>
>                 Key: CLOWNFISH-62
>                 URL: https://issues.apache.org/jira/browse/CLOWNFISH-62
>             Project: Apache Lucy-Clownfish
>          Issue Type: Bug
>          Components: Perl
>    Affects Versions: 0.4.0, 0.5.0
>            Reporter: Nick Wellnhofer
>             Fix For: 0.5.0
>
>
> Passing a Perl variable to a method that takes a "decremented" argument results in a use-after-free. Example
> {noformat}
> perl -MClownfish -e 'Clownfish::Vector->new->push("abc")'
> {noformat}
> Analysis:
> - A Clownfish "stack" string is created from the string value of the Perl variable.
> - The stack string is passed to Vec_Push.
> - The stack string is never incref'd.
> - The copy-on-incref mechanism isn't invoked.
> - When the Vector is destroyed, the stack string is decref'd, accessing random stack memory.
> A possible solution is to forgo the stack string optimization for decremented arguments.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)