Loading ...
Sorry, an error occurred while loading the content.
 

[Cheetahtemplate-discuss] crash in _namemapper

Expand Messages
  • Eric Huss
    I stumbled across a situation where _namemapper is causing a segmentation fault. I m using Cheetah 2.0rc8 with Python 2.5.1. I ve got a small reproduction
    Message 1 of 2 , Sep 29, 2007
      I stumbled across a situation where _namemapper is causing a segmentation
      fault. I'm using Cheetah 2.0rc8 with Python 2.5.1.

      I've got a small reproduction with this template:

      #def body
      #set $somevar = $getVar('somevar')
      #end def
      $body

      This crashes in the wrapInternalNotFoundException function. It calls:

      PyObject_CallMethod(excValue, "find", "s", "while searching")

      in a situation where excValue is a NotFound exception instance. I won't
      go into the exact details, but it's because of some unwinding of some
      recursive calls, python has normalized the exception set earlier which
      turns the exception value from a string into a NotFound instance.

      The isAlreadyWrapped value is NULL because a NotFound instance doesn't
      have a "find" method. However, the code is not checking for that. I
      think it would make sense to simply wrap this code in a check if
      isAlreadyWrapped is NULL, and fall down to the PyErr_Restore line if it
      is. In other words, ignore errors from trying to call "find". I can
      submit a patch if that would help.

      -Eric

      -------------------------------------------------------------------------
      This SF.net email is sponsored by: Microsoft
      Defy all challenges. Microsoft(R) Visual Studio 2005.
      http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Tavis Rudd
      Hi Eric, Thanks for reporting this. Can you send a patch my way? Cheers, Tavis ... This SF.net email is sponsored by: Microsoft Defy all challenges.
      Message 2 of 2 , Oct 1, 2007
        Hi Eric,
        Thanks for reporting this. Can you send a patch my way?
        Cheers,
        Tavis

        On Sat, 29 Sep 2007, Eric Huss wrote:

        > I stumbled across a situation where _namemapper is causing a segmentation
        > fault. I'm using Cheetah 2.0rc8 with Python 2.5.1.
        >
        > I've got a small reproduction with this template:
        >
        > #def body
        > #set $somevar = $getVar('somevar')
        > #end def
        > $body
        >
        > This crashes in the wrapInternalNotFoundException function. It calls:
        >
        > PyObject_CallMethod(excValue, "find", "s", "while searching")
        >
        > in a situation where excValue is a NotFound exception instance. I won't
        > go into the exact details, but it's because of some unwinding of some
        > recursive calls, python has normalized the exception set earlier which
        > turns the exception value from a string into a NotFound instance.
        >
        > The isAlreadyWrapped value is NULL because a NotFound instance doesn't
        > have a "find" method. However, the code is not checking for that. I
        > think it would make sense to simply wrap this code in a check if
        > isAlreadyWrapped is NULL, and fall down to the PyErr_Restore line if it
        > is. In other words, ignore errors from trying to call "find". I can
        > submit a patch if that would help.
        >
        > -Eric
        >
        > -------------------------------------------------------------------------
        > This SF.net email is sponsored by: Microsoft
        > Defy all challenges. Microsoft(R) Visual Studio 2005.
        > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
        > _______________________________________________
        > Cheetahtemplate-discuss mailing list
        > Cheetahtemplate-discuss@...
        > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        >

        -------------------------------------------------------------------------
        This SF.net email is sponsored by: Microsoft
        Defy all challenges. Microsoft(R) Visual Studio 2005.
        http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      Your message has been successfully submitted and would be delivered to recipients shortly.