@@ -73,7 +73,7 @@ Fw::Success FpySequencer::validate() {
7373 if (readStatus != Fw::Success::SUCCESS) {
7474 return Fw::Success::FAILURE;
7575 }
76-
76+
7777 // read footer bytes but don't include in CRC
7878 readStatus = this ->readBytes (sequenceFile, Fpy::Footer::SERIALIZED_SIZE, FpySequencer_FileReadStage::FOOTER, false );
7979
@@ -147,7 +147,7 @@ Fw::Success FpySequencer::readBody() {
147147 Fw::SerializeStatus deserStatus;
148148
149149 const U8 argumentCount = this ->m_sequenceObj .get_header ().get_argumentCount ();
150- Fpy::StackSizeType totalExpectedSize = 0 ;
150+ this -> m_totalReadArgumentSize = 0 ;
151151
152152 // deser arguments
153153 // Read and deserialize each arg_spec incrementally since they're variable-length
@@ -201,13 +201,21 @@ Fw::Success FpySequencer::readBody() {
201201 }
202202
203203 // Check for overflow before accumulation
204- if (totalExpectedSize > Fpy::MAX_STACK_SIZE - argSize) {
204+ if (m_totalReadArgumentSize > Fpy::MAX_STACK_SIZE - argSize) {
205205 this ->log_WARNING_HI_ArgTotalSizeExceedsStackLimit (argSize, Fpy::MAX_STACK_SIZE,
206206 this ->m_sequenceFilePath );
207207 return Fw::Success::FAILURE;
208208 }
209209 argSpec.set_argSize (argSize);
210- totalExpectedSize += argSize;
210+ m_totalReadArgumentSize += argSize;
211+ }
212+
213+ // Validate total argument size
214+ if (this ->m_totalReadArgumentSize != this ->m_sequenceArgs .get_size ()){
215+ this ->log_WARNING_HI_ArgSizeMismatch (this ->m_sequenceObj .get_header ().get_argumentCount (),
216+ this ->m_sequenceArgs .get_size (),
217+ this ->m_sequenceFilePath );
218+ return Fw::Success::FAILURE;
211219 }
212220
213221 // deser statements
0 commit comments