Skip to content

Commit

Permalink
fix bug in applyPatchToSerializedData(...) that doesn't handle bool f…
Browse files Browse the repository at this point in the history
…ield correctly

Reviewed By: praihan, thedavekwon

Differential Revision: D62931361

fbshipit-source-id: eecdd03a61ed6bb393d0c89c073cff5766795b52
  • Loading branch information
TJ Yin authored and facebook-github-bot committed Sep 20, 2024
1 parent 20a3bd8 commit 9ac5fa3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions thrift/lib/cpp2/protocol/detail/FieldMaskUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,17 @@ MaskedDecodeResultValue parseValueWithMask(
MaskedProtocolData& protocolData,
bool string_to_binary = true) {
MaskedDecodeResultValue result;
if (arg_type == protocol::T_BOOL) {
// For Compact protocol, Bool field values are encoded directly in the field
// header, in which case the encoded value will be empty.
//
// https://github.com/apache/thrift/blob/master/doc/specs/thrift-compact-protocol.md#boolean-encoding
//
// Given that the bool field is cheap to decode, we can just decode it
// unconditionally.
prot.readBool(result.included.emplace_bool());
return result;
}
if (readMaskRef.isAllMask()) { // serialize all
parseValueInplace(prot, arg_type, result.included, string_to_binary);
return result;
Expand Down

0 comments on commit 9ac5fa3

Please sign in to comment.