From 9e42883d4b5480e677dbe3b98970422e0bc7eb93 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 15 May 2021 00:10:02 +0000 Subject: [PATCH] Fix a bug in input deserialization in the C SDK (#17217) (#17249) 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 e02b4e1192f73212bbb9fbe323aacd438a799196) Co-authored-by: Christian Machacek <39452430+machacekch@users.noreply.github.com> --- sdk/bpf/c/inc/solana_sdk.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/bpf/c/inc/solana_sdk.h b/sdk/bpf/c/inc/solana_sdk.h index 99a671c13a..3c91431cce 100644 --- a/sdk/bpf/c/inc/solana_sdk.h +++ b/sdk/bpf/c/inc/solana_sdk.h @@ -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; }