+2012-11-27 Kai Tietz <ktietz@redhat.com>
+
+ * resbin.c (bin_to_res_version): Correct offset
+ and length calculation of resource.
+ (get_version_header): Apply alignement of 4 to len.
+
2012-11-16 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (process_dynamic_section): Correct DF_1_CONFALT.
if (length < 8)
toosmall (key);
- *len = windres_get_16 (wrbfd, data, 2);
+ *len = (windres_get_16 (wrbfd, data, 2) + 3) & ~3;
*vallen = windres_get_16 (wrbfd, data + 2, 2);
*type = windres_get_16 (wrbfd, data + 4, 2);
data += off;
length -= off;
- /* It's convenient to round verlen to a 4 byte alignment,
- since we round the subvariables in the loop. */
-
- verlen = (verlen + 3) &~ 3;
+ verlen -= off;
vi->u.string.stringtables = NULL;
ppvst = &vi->u.string.stringtables;
length -= off;
verlen -= off;
- stverlen = (stverlen + 3) &~ 3;
+ stverlen -= off;
vst->strings = NULL;
ppvs = &vst->strings;
get_version_header (wrbfd, data, length, (const char *) NULL,
&vs->key, &sverlen, &vallen, &type, &off);
- sverlen = (sverlen + 3) &~ 3;
-
data += off;
length -= off;
vs->value = get_unicode (wrbfd, data, length, &vslen);
valoff = vslen * 2 + 2;
- valoff = (valoff + 3) &~ 3;
+ valoff = (valoff + 3) & ~3;
if (off + valoff != sverlen)
fatal (_("unexpected version string length %ld != %ld + %ld"),
fatal (_("unexpected version string length %ld < %ld"),
(long) verlen, (long) sverlen);
stverlen -= sverlen;
+ verlen -= sverlen;
vs->next = NULL;
*ppvs = vs;