Skip to content

Commit

Permalink
Fix a bug in input deserialization in the C SDK (#17217)
Browse files Browse the repository at this point in the history
When the input contains more accounts than the user has requested to be deserialized, and one of the excess ones is a dup, the input pointer is not adjusted correctly.

Compare the lines added by this commit to line 401: "input += 7; // padding". Since the input data layout does not depend on the number of accounts the user wants to deserialize, this adjustment by 7 bytes must happen in both branches.

(cherry picked from commit e02b4e1)
  • Loading branch information
machacekch authored and mergify-bot committed May 14, 2021
1 parent 9aacd0f commit 8593246
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sdk/bpf/c/inc/solana_sdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ static bool sol_deserialize(
input += MAX_PERMITTED_DATA_INCREASE;
input = (uint8_t*)(((uint64_t)input + 8 - 1) & ~(8 - 1)); // padding
input += sizeof(uint64_t);
} else {
input += 7; // padding
}
continue;
}
Expand Down

0 comments on commit 8593246

Please sign in to comment.