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)
5151 bfd * abfd ;
5252 windres_bfd wrbfd ;
5353 asection * sec ;
54- bfd_size_type size ;
5554
5655 abfd = bfd_openr (filename , target );
5756 if (abfd == NULL ) {
@@ -64,14 +63,16 @@ fuzz_check_coff_rsrc (const char *filename, const char *target)
6463 }
6564
6665 sec = bfd_get_section_by_name (abfd , ".rsrc" );
67- if (sec == NULL ) {
66+ if (sec == NULL || sec -> size == 0 ) {
6867 retval = 0 ;
6968 goto cleanup ;
7069 }
7170
7271 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 ) {
7576 retval = 0 ;
7677 goto cleanup ;
7778 }
You can’t perform that action at this time.
0 commit comments