Skip to content

Commit 15b6098

Browse files
bitWarriorbitWarrior
authored andcommitted
Added validation of assert params
1 parent 883fbcd commit 15b6098

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Fw/Types/Serializable.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,12 @@ SerializeStatus LinearBufferBase::deserializeTo(U8* buff,
531531
return FW_DESERIALIZE_SIZE_MISMATCH;
532532
}
533533

534+
// Validate buff is non-null whenever buffCapacity > 0, and buffCapacity
535+
// is sufficient to hold the requested length.
536+
FW_ASSERT(buffCapacity >= static_cast<FwSizeType>(length),
537+
static_cast<FwAssertArgType>(buffCapacity),
538+
static_cast<FwAssertArgType>(length));
539+
534540
// endianMode is an enum; an out-of-range value indicates a caller bug.
535541
FW_ASSERT(endianMode == Endianness::BIG || endianMode == Endianness::LITTLE,
536542
static_cast<FwAssertArgType>(endianMode));

0 commit comments

Comments
 (0)