Skip to content

Commit

Permalink
Make opaque closure constructor more robust (#48739)
Browse files Browse the repository at this point in the history
By type checking the nargs argument rather than just assuming. It's
easy for people to end up with the wrong integer type here.
  • Loading branch information
Keno authored Feb 21, 2023
1 parent 0975906 commit a4d6ddd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/method.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ static jl_value_t *resolve_globals(jl_value_t *expr, jl_module_t *module, jl_sve
jl_error("opaque_closure_method: invalid syntax");
}
jl_value_t *name = jl_exprarg(e, 0);
jl_value_t *nargs = jl_exprarg(e, 1);
jl_value_t *oc_nargs = jl_exprarg(e, 1);
int isva = jl_exprarg(e, 2) == jl_true;
jl_value_t *functionloc = jl_exprarg(e, 3);
jl_value_t *ci = jl_exprarg(e, 4);
if (!jl_is_code_info(ci)) {
jl_error("opaque_closure_method: lambda should be a CodeInfo");
} else if (!jl_is_long(oc_nargs)) {
jl_type_error("opaque_closure_method", (jl_value_t*)jl_long_type, oc_nargs);
}
jl_method_t *m = jl_make_opaque_closure_method(module, name, jl_unbox_long(nargs), functionloc, (jl_code_info_t*)ci, isva);
jl_method_t *m = jl_make_opaque_closure_method(module, name, jl_unbox_long(oc_nargs), functionloc, (jl_code_info_t*)ci, isva);
return (jl_value_t*)m;
}
if (e->head == jl_cfunction_sym) {
Expand Down

4 comments on commit a4d6ddd

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected.
A full report can be found here.

@vtjnash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

Please sign in to comment.