File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,6 @@ fuzz_check_coff_rsrc (const char *filename, const char *target)
51
51
bfd * abfd ;
52
52
windres_bfd wrbfd ;
53
53
asection * sec ;
54
- bfd_size_type size ;
55
54
56
55
abfd = bfd_openr (filename , target );
57
56
if (abfd == NULL ) {
@@ -64,14 +63,16 @@ fuzz_check_coff_rsrc (const char *filename, const char *target)
64
63
}
65
64
66
65
sec = bfd_get_section_by_name (abfd , ".rsrc" );
67
- if (sec == NULL ) {
66
+ if (sec == NULL || sec -> size == 0 ) {
68
67
retval = 0 ;
69
68
goto cleanup ;
70
69
}
71
70
72
71
set_windres_bfd (& wrbfd , abfd , sec , WR_KIND_BFD );
73
- size = bfd_section_size (sec );
74
- if (size > (bfd_size_type ) get_file_size (filename )) {
72
+
73
+ bfd_size_type filesize = get_file_size (filename );
74
+ if ((ufile_ptr ) sec -> filepos > filesize
75
+ || sec -> size > filesize - sec -> filepos ) {
75
76
retval = 0 ;
76
77
goto cleanup ;
77
78
}
You can’t perform that action at this time.
0 commit comments