Skip to content

Commit 8f10bb7

Browse files
committed
fix: the program distinguishes padding from app
Signed-off-by: Mohamed Daoudo <mohamed.daoudo@stud.fils.upb.ro>
1 parent 4477a41 commit 8f10bb7

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

tockloader-lib/src/attributes/app_attributes.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,19 @@ impl AppAttributes {
112112
// The end of the application binary marks the beginning of the
113113
// footer.
114114
//
115-
// TODO(george-cosma): This is not always true, `get_binary_end`
115+
// Note: This is not always true, `get_binary_end`
116116
// does not make sense if the application is just padding. This can
117117
// crash the process.
118118
let binary_end_offset = header.get_binary_end();
119119

120+
match &header {
121+
TbfHeader::TbfHeaderV2(_hd) => {}
122+
_ => {
123+
appaddr += total_size as u64;
124+
continue;
125+
}
126+
};
127+
120128
let mut footers: Vec<TbfFooter> = vec![];
121129
let total_footers_size = total_size - binary_end_offset;
122130
let mut footer_offset = binary_end_offset;
@@ -234,6 +242,14 @@ impl AppAttributes {
234242
.map_err(TockError::InvalidAppTbfHeader)?;
235243
let binary_end_offset = header.get_binary_end();
236244

245+
match &header {
246+
TbfHeader::TbfHeaderV2(_hd) => {}
247+
_ => {
248+
appaddr += total_size as u64;
249+
continue;
250+
}
251+
};
252+
237253
let mut footers: Vec<TbfFooter> = vec![];
238254
let total_footers_size = total_size - binary_end_offset;
239255
let mut footer_offset = binary_end_offset;

0 commit comments

Comments
 (0)