Skip to content

Commit ccaa5d4

Browse files
committed
Fix allocation computation in stacktrace_build
This bug could yield a crash yet was not observed with current GC/memory implementation Signed-off-by: Paul Guyot <[email protected]>
1 parent 1950aaa commit ccaa5d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libAtomVM/stacktrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ term stacktrace_build(Context *ctx, term *stack_info)
261261
//
262262
// [{module, function, arity, [{file, string()}, {line, int}]}, ...]
263263
//
264-
size_t requested_size = (TUPLE_SIZE(4) + 2) * num_frames + num_aux_terms * (2 + 2 * TUPLE_SIZE(2)) + 2 * filename_lens;
264+
size_t requested_size = (TUPLE_SIZE(4) + 2) * num_frames + num_aux_terms * (4 + 2 * TUPLE_SIZE(2)) + 2 * filename_lens;
265265
if (UNLIKELY(memory_ensure_free(ctx, requested_size) != MEMORY_GC_OK)) {
266266
free(module_paths);
267267
return OUT_OF_MEMORY_ATOM;

0 commit comments

Comments
 (0)