You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2010/06/23 18:38:49 UTC

[jira] Created: (THRIFT-808) Segfault when constant declaration references a struct field that doesn't exist

Segfault when constant declaration references a struct field that doesn't exist
-------------------------------------------------------------------------------

                 Key: THRIFT-808
                 URL: https://issues.apache.org/jira/browse/THRIFT-808
             Project: Thrift
          Issue Type: Bug
            Reporter: Bryan Duxbury
            Assignee: Bryan Duxbury
            Priority: Minor
             Fix For: 0.4


When attempting to generate code for a Thrift file like:

{code}

struct X {
  required string my_field;
}

const X CONSTANT_X = {
  'my_field_1' : 'blah'
}

{code}

I find that I get a segfault. GDB tracks it back to line 99 of t_scope.h, where it looks like we try to get a t_field object from the parent struct by name, and then ultimately don't check if we actually got back something valid or not. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-808) Segfault when constant declaration references a struct field that doesn't exist

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12881742#action_12881742 ] 

David Reiss commented on THRIFT-808:
------------------------------------

Indentation looks way off.  Otherwise, LG.

> Segfault when constant declaration references a struct field that doesn't exist
> -------------------------------------------------------------------------------
>
>                 Key: THRIFT-808
>                 URL: https://issues.apache.org/jira/browse/THRIFT-808
>             Project: Thrift
>          Issue Type: Bug
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>            Priority: Minor
>             Fix For: 0.4
>
>         Attachments: thrift-808.patch
>
>
> When attempting to generate code for a Thrift file like:
> {code}
> struct X {
>   required string my_field;
> }
> const X CONSTANT_X = {
>   'my_field_1' : 'blah'
> }
> {code}
> I find that I get a segfault. GDB tracks it back to line 99 of t_scope.h, where it looks like we try to get a t_field object from the parent struct by name, and then ultimately don't check if we actually got back something valid or not. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-808) Segfault when constant declaration references a struct field that doesn't exist

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-808:
---------------------------------

    Attachment: thrift-808.patch

This patch causes an exception to be thrown when the field we try to get comes back null.

> Segfault when constant declaration references a struct field that doesn't exist
> -------------------------------------------------------------------------------
>
>                 Key: THRIFT-808
>                 URL: https://issues.apache.org/jira/browse/THRIFT-808
>             Project: Thrift
>          Issue Type: Bug
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>            Priority: Minor
>             Fix For: 0.4
>
>         Attachments: thrift-808.patch
>
>
> When attempting to generate code for a Thrift file like:
> {code}
> struct X {
>   required string my_field;
> }
> const X CONSTANT_X = {
>   'my_field_1' : 'blah'
> }
> {code}
> I find that I get a segfault. GDB tracks it back to line 99 of t_scope.h, where it looks like we try to get a t_field object from the parent struct by name, and then ultimately don't check if we actually got back something valid or not. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-808) Segfault when constant declaration references a struct field that doesn't exist

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-808:
---------------------------------

    Patch Info: [Patch Available]

> Segfault when constant declaration references a struct field that doesn't exist
> -------------------------------------------------------------------------------
>
>                 Key: THRIFT-808
>                 URL: https://issues.apache.org/jira/browse/THRIFT-808
>             Project: Thrift
>          Issue Type: Bug
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>            Priority: Minor
>             Fix For: 0.4
>
>         Attachments: thrift-808.patch
>
>
> When attempting to generate code for a Thrift file like:
> {code}
> struct X {
>   required string my_field;
> }
> const X CONSTANT_X = {
>   'my_field_1' : 'blah'
> }
> {code}
> I find that I get a segfault. GDB tracks it back to line 99 of t_scope.h, where it looks like we try to get a t_field object from the parent struct by name, and then ultimately don't check if we actually got back something valid or not. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (THRIFT-808) Segfault when constant declaration references a struct field that doesn't exist

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury closed THRIFT-808.
--------------------------------

    Resolution: Fixed

I fixed the indentation and committed this. 

> Segfault when constant declaration references a struct field that doesn't exist
> -------------------------------------------------------------------------------
>
>                 Key: THRIFT-808
>                 URL: https://issues.apache.org/jira/browse/THRIFT-808
>             Project: Thrift
>          Issue Type: Bug
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>            Priority: Minor
>             Fix For: 0.4
>
>         Attachments: thrift-808.patch
>
>
> When attempting to generate code for a Thrift file like:
> {code}
> struct X {
>   required string my_field;
> }
> const X CONSTANT_X = {
>   'my_field_1' : 'blah'
> }
> {code}
> I find that I get a segfault. GDB tracks it back to line 99 of t_scope.h, where it looks like we try to get a t_field object from the parent struct by name, and then ultimately don't check if we actually got back something valid or not. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.