Skip to content

Commit

Permalink
Wrong unmarshaling of function pointers in debugger mode
Browse files Browse the repository at this point in the history
In debugger mode, closures sent by the debuggee have their code pointer
modified so that it points to the `function_placeholder` code in
debugger/main.ml.

This modification was performed incorrectly: the whole closure for
`function_placeholder` was used as the code pointer for the
unmarshalled closure.

This commit implements the correct operation: the code pointer from
`function_placeholder` is used as code pointer for the unmarshaled
closure.

Fixes: ocaml#9214
  • Loading branch information
xavierleroy committed Oct 18, 2021
1 parent 342f6dd commit 611b2ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/intern.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ static void intern_rec(value *dest)
const value * function_placeholder =
caml_named_value ("Debugger.function_placeholder");
if (function_placeholder != NULL) {
v = *function_placeholder;
/* Use the code pointer from the "placeholder" function */
v = Field(*function_placeholder, 0);
} else {
intern_cleanup();
intern_bad_code_pointer(digest);
Expand Down

0 comments on commit 611b2ac

Please sign in to comment.