Skip to content

Commit

Permalink
Fix incorrect deserialization of CBOR CIDs (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
alnkesq authored Jan 16, 2025
1 parent 556b622 commit 15df774
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/FishyFlip/CborExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@ internal static class CborExtensions
{
case CBORType.ByteString:
var cid = obj.GetByteString();
return Cid.Read(cid);
if (cid[0] != 0)
{
logger?.LogError("ATCid CBOR bytes should start with 0.");
return null;
}

return Cid.Read(cid.AsSpan(1).ToArray());
case CBORType.TextString:
return Cid.Decode(obj.AsString());
}
Expand Down

0 comments on commit 15df774

Please sign in to comment.