We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eb3b075 commit 6e050d8Copy full SHA for 6e050d8
1 file changed
sdk/serviceability/typescript/serviceability/state.ts
@@ -550,6 +550,10 @@ function deserializeInterface(r: DefensiveReader): DeviceInterface {
550
const segCount = r.readU32();
551
const flexAlgoNodeSegments: FlexAlgoNodeSegment[] = [];
552
for (let i = 0; i < segCount; i++) {
553
+ // Break early if there isn't enough data for a full segment. On pre-RFC-18
554
+ // mainnet accounts, segCount reads garbage bytes from the next field, so
555
+ // without this guard the loop runs hundreds of thousands of times.
556
+ if (r.remaining < 34) break; // 32 (pubkey) + 2 (u16)
557
flexAlgoNodeSegments.push({
558
topology: readPubkey(r),
559
nodeSegmentIdx: r.readU16(),
0 commit comments