Skip to content

Commit aa877f9

Browse files
committed
[CI 15963] engine: deploy: Make sure success is checked before reading fields from read structs in MCDeployToELF.
1 parent e7f4933 commit aa877f9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

engine/src/deploy_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ Exec_stat MCDeployToELF(const MCDeployParameters& p_params, bool p_is_android)
686686
typename T::Shdr *t_project_section, *t_payload_section;
687687
t_project_section = NULL;
688688
t_payload_section = NULL;
689-
for(uint32_t i = 0; i < t_header . e_shnum && t_project_section == NULL && t_success; i++)
689+
for(uint32_t i = 0; i < t_success && t_header . e_shnum && t_project_section == NULL && t_success; i++)
690690
{
691691
char *t_section_name;
692692
t_success = MCDeployToLinuxReadString<T>(t_engine, t_section_headers[t_header . e_shstrndx], t_section_headers[i] . sh_name, t_section_name);
@@ -724,7 +724,7 @@ Exec_stat MCDeployToELF(const MCDeployParameters& p_params, bool p_is_android)
724724
// that segment must be the last.
725725
typename T::Phdr *t_project_segment;
726726
t_project_segment = NULL;
727-
for(uint32_t i = 0; i < t_header . e_phnum && t_success; i++)
727+
for(uint32_t i = 0; t_success && i < t_header . e_phnum; i++)
728728
if (t_project_section -> sh_addr >= t_program_headers[i] . p_vaddr &&
729729
t_project_section -> sh_addr + t_project_section -> sh_size <= t_program_headers[i] . p_vaddr + t_program_headers[i] . p_memsz)
730730
{

0 commit comments

Comments
 (0)