File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -175,19 +175,20 @@ static int read_sections(struct elf *elf)
175
175
return -1 ;
176
176
}
177
177
178
- sec -> data = elf_getdata (s , NULL );
179
- if (!sec -> data ) {
180
- WARN_ELF ("elf_getdata" );
181
- return -1 ;
182
- }
183
-
184
- if (sec -> data -> d_off != 0 ||
185
- sec -> data -> d_size != sec -> sh .sh_size ) {
186
- WARN ("unexpected data attributes for %s" , sec -> name );
187
- return -1 ;
178
+ if (sec -> sh .sh_size != 0 ) {
179
+ sec -> data = elf_getdata (s , NULL );
180
+ if (!sec -> data ) {
181
+ WARN_ELF ("elf_getdata" );
182
+ return -1 ;
183
+ }
184
+ if (sec -> data -> d_off != 0 ||
185
+ sec -> data -> d_size != sec -> sh .sh_size ) {
186
+ WARN ("unexpected data attributes for %s" ,
187
+ sec -> name );
188
+ return -1 ;
189
+ }
188
190
}
189
-
190
- sec -> len = sec -> data -> d_size ;
191
+ sec -> len = sec -> sh .sh_size ;
191
192
}
192
193
193
194
/* sanity check, one more call to elf_nextscn() should return NULL */
You can’t perform that action at this time.
0 commit comments