Skip to content

Commit

Permalink
Check for NULL before memcpy()
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterDuke17 committed Nov 24, 2024
1 parent 385827c commit 79edc97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/6model/serialization.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,8 +901,9 @@ static MVMObject * concatenate_outputs(MVMThreadContext *tc, MVMSerializationWri
/* Put repossessions table in place, and set location/rows in header. */
write_int32(output, 56, offset);
write_int32(output, 60, writer->root.num_repos);
memcpy(output + offset, writer->root.repos_table,
writer->root.num_repos * REPOS_TABLE_ENTRY_SIZE);
if (writer->root.repos_table != NULL)
memcpy(output + offset, writer->root.repos_table,
writer->root.num_repos * REPOS_TABLE_ENTRY_SIZE);
offset += MVM_ALIGN_SECTION(writer->root.num_repos * REPOS_TABLE_ENTRY_SIZE);

/* Put parameterized type intern data in place. */
Expand Down

0 comments on commit 79edc97

Please sign in to comment.