git: 12db51d20823 - main - uefisign: handle empty sections
Eric van Gyzen
vangyzen at FreeBSD.org
Wed Apr 7 16:24:47 UTC 2021
The branch main has been updated by vangyzen:
URL: https://cgit.FreeBSD.org/src/commit/?id=12db51d20823a5e3b9e5f8a2ea73156fe1cbfc28
commit 12db51d20823a5e3b9e5f8a2ea73156fe1cbfc28
Author: Eric van Gyzen <vangyzen at FreeBSD.org>
AuthorDate: 2021-04-06 14:42:20 +0000
Commit: Eric van Gyzen <vangyzen at FreeBSD.org>
CommitDate: 2021-04-07 16:23:11 +0000
uefisign: handle empty sections
loader.efi has an empty set_Xfic section. Handle it correctly.
```
Sections:
Idx Name Size VMA LMA File off Algn
[...]
3 set_Xcom 00000168 00000000000d4000 00000000000d4000 000d0e00 2**2
CONTENTS, ALLOC, LOAD, DATA
4 set_Xfic 00000000 00000000000d4168 00000000000d4168 00000000 2**2
ALLOC, LOAD, DATA
5 .sdata 00000448 00000000000d5000 00000000000d5000 000d1000 2**2
CONTENTS, ALLOC, LOAD, DATA
[...]
```
Reviewed by: trasz, dab
Reported by: andy.y.liu at dell.com
Tested by: andy.y.liu at dell.com
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29606
---
usr.sbin/uefisign/pe.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr.sbin/uefisign/pe.c b/usr.sbin/uefisign/pe.c
index 9f010e5d8a46..6459321441d8 100644
--- a/usr.sbin/uefisign/pe.c
+++ b/usr.sbin/uefisign/pe.c
@@ -244,7 +244,8 @@ parse_section_table(struct executable *x, off_t off, int number_of_sections)
x->x_nsections = number_of_sections;
for (i = 0; i < number_of_sections; i++) {
- if (psh->psh_pointer_to_raw_data < x->x_headers_len)
+ if (psh->psh_size_of_raw_data > 0 &&
+ psh->psh_pointer_to_raw_data < x->x_headers_len)
errx(1, "section points inside the headers");
range_check(x, psh->psh_pointer_to_raw_data,
More information about the dev-commits-src-all
mailing list