Skip to content

Commit

Permalink
Fix segmentation fault on big message serialization (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenraven authored Jul 13, 2021
1 parent 4691f18 commit 837db87
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/util/func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ namespace faabric::util {
std::vector<uint8_t> messageToBytes(const faabric::Message& msg)
{
size_t byteSize = msg.ByteSizeLong();
uint8_t buffer[byteSize];
msg.SerializeToArray(buffer, (int)byteSize);

std::vector<uint8_t> inputData(buffer, buffer + byteSize);
std::vector<uint8_t> inputData(byteSize, 0);
msg.SerializeToArray(inputData.data(), (int)inputData.size());

return inputData;
}
Expand Down

0 comments on commit 837db87

Please sign in to comment.