The attached patch fixes an issue where very small .res files weren't
recognized properly. See added comment for detailed information. Please
contact me in case of further questions.

Sincerely,
Thomas Weidenmueller
Index: resres.c
===================================================================
RCS file: /cvs/src/src/binutils/resres.c,v
retrieving revision 1.9
diff -u -r1.9 resres.c
--- resres.c    23 May 2007 08:48:29 -0000      1.9
+++ resres.c    8 Jun 2007 14:57:55 -0000
@@ -592,7 +592,10 @@
   if ((off + BIN_RES_HDR_SIZE) >= omax)
     return 1;
   read_res_data_hdr (wrbfd, &off, omax, &reshdr);
-  if ((off + reshdr.data_size + reshdr.header_size) > omax)
+  /* off was advanced by BIN_RES_HDR_SIZE in read_res_data_hdr()
+     which is part of reshdr.header_size. We shouldn't take it
+     into account twice. */
+  if ((off - BIN_RES_HDR_SIZE + reshdr.data_size + reshdr.header_size) > omax)
       return 0;
   return 1;
 }
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to