[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch] WINDRES: Fix bounds checking in probe_binary()
From: |
Thomas Weidenmueller |
Subject: |
[patch] WINDRES: Fix bounds checking in probe_binary() |
Date: |
Fri, 08 Jun 2007 17:08:30 +0200 |
User-agent: |
Thunderbird 2.0.0.0 (Windows/20070326) |
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;
}
- [patch] WINDRES: Fix bounds checking in probe_binary(),
Thomas Weidenmueller <=