diff options
Diffstat (limited to 'common/EncoreBootImage.cpp')
-rw-r--r-- | common/EncoreBootImage.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/EncoreBootImage.cpp b/common/EncoreBootImage.cpp index 26b1194..d747bfb 100644 --- a/common/EncoreBootImage.cpp +++ b/common/EncoreBootImage.cpp @@ -698,6 +698,7 @@ void EncoreBootImage::BootCommand::validateHeader(const boot_command_t * modelHe //! \exception std::runtime_error Thrown if header fields are invalid. void EncoreBootImage::NopCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed) { + assert((sizeof(cipher_block_t) * count) == sizeof(boot_command_t)); const boot_command_t model = { 0, ROM_NOP_CMD, 0, 0, 0, 0 }; const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks); validateHeader(&model, header, CMD_TAG_FIELD | CMD_FLAGS_FIELD | CMD_ADDRESS_FIELD | CMD_COUNT_FIELD | CMD_DATA_FIELD); @@ -744,6 +745,7 @@ EncoreBootImage::TagCommand::TagCommand(const Section & section) //! \exception std::runtime_error Thrown if header fields are invalid. void EncoreBootImage::TagCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed) { + assert((sizeof(cipher_block_t) * count) == sizeof(boot_command_t)); const boot_command_t model = { 0, ROM_TAG_CMD, 0, 0, 0, 0 }; const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks); validateHeader(&model, header, CMD_TAG_FIELD); @@ -801,6 +803,7 @@ EncoreBootImage::LoadCommand::LoadCommand(uint32_t address, const uint8_t * data //! specified in the command header or if header fields are invalid. void EncoreBootImage::LoadCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed) { + assert((sizeof(cipher_block_t) * count) == sizeof(boot_command_t)); // check static fields const boot_command_t model = { 0, ROM_LOAD_CMD, 0, 0, 0, 0 }; const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks); @@ -995,6 +998,7 @@ EncoreBootImage::FillCommand::FillCommand() //! \exception std::runtime_error Thrown if header fields are invalid. void EncoreBootImage::FillCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed) { + assert((sizeof(cipher_block_t) * count) == sizeof(boot_command_t)); // check static fields const boot_command_t model = { 0, ROM_FILL_CMD, 0, 0, 0, 0 }; const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks); @@ -1051,6 +1055,7 @@ void EncoreBootImage::FillCommand::debugPrint() const //! \exception std::runtime_error Thrown if header fields are invalid. void EncoreBootImage::ModeCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed) { + assert((sizeof(cipher_block_t) * count) == sizeof(boot_command_t)); // check static fields const boot_command_t model = { 0, ROM_MODE_CMD, 0, 0, 0, 0 }; const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks); @@ -1086,6 +1091,7 @@ void EncoreBootImage::ModeCommand::debugPrint() const //! \exception std::runtime_error Thrown if header fields are invalid. void EncoreBootImage::JumpCommand::initFromData(const cipher_block_t * blocks, unsigned count, unsigned * consumed) { + assert((sizeof(cipher_block_t) * count) == sizeof(boot_command_t)); // check static fields const boot_command_t model = { 0, getTag(), 0, 0, 0, 0 }; const boot_command_t * header = reinterpret_cast<const boot_command_t *>(blocks); |