Mercurial > octave-nkf
comparison libinterp/octave-value/ov-fcn-handle.cc @ 17896:f05f571ff1fa
Fix null pointer access in octave_fcn_binder::maybe_binder
* libinterp/octave-value/ov-fcn-handle.cc(maybe_binder): Avoid possible null
pointer access.
author | PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> |
---|---|
date | Sun, 10 Nov 2013 12:26:14 +0530 |
parents | 175b392e91fe |
children | 8c33abdd2f9a |
comparison
equal
deleted
inserted
replaced
17895:ed2ef5d96929 | 17896:f05f571ff1fa |
---|---|
1882 octave_fcn_handle *retval = 0; | 1882 octave_fcn_handle *retval = 0; |
1883 | 1883 |
1884 octave_user_function *usr_fcn = f.user_function_value (false); | 1884 octave_user_function *usr_fcn = f.user_function_value (false); |
1885 tree_parameter_list *param_list = usr_fcn ? usr_fcn->parameter_list () : 0; | 1885 tree_parameter_list *param_list = usr_fcn ? usr_fcn->parameter_list () : 0; |
1886 | 1886 |
1887 // Verify that the body is a single expression (always true in theory). | 1887 tree_statement_list *cmd_list = NULL; |
1888 | 1888 tree_expression *body_expr = NULL; |
1889 tree_statement_list *cmd_list = usr_fcn ? usr_fcn->body () : 0; | 1889 |
1890 tree_expression *body_expr = (cmd_list->length () == 1 | 1890 if (usr_fcn) |
1891 ? cmd_list->front ()->expression () : 0); | 1891 { |
1892 | 1892 cmd_list = usr_fcn->body (); |
1893 if (cmd_list) | |
1894 { | |
1895 // Verify that body is a single expression (always true in theory). | |
1896 body_expr = (cmd_list->length () == 1 | |
1897 ? cmd_list->front ()->expression () : 0); | |
1898 } | |
1899 } | |
1893 | 1900 |
1894 if (body_expr && body_expr->is_index_expression () | 1901 if (body_expr && body_expr->is_index_expression () |
1895 && ! (param_list && param_list->takes_varargs ())) | 1902 && ! (param_list && param_list->takes_varargs ())) |
1896 { | 1903 { |
1897 // It's an index expression. | 1904 // It's an index expression. |