Hi,
for strings of the right size just below the pagesize, not enough memory
was allocated, and malloc internals got corrupted, eventually leading to:
$ ./src/writer ./src/dwarflint
*** glibc detected *** ./src/writer: malloc(): memory corruption:
0x0000000013d3e860 ***
Reproducer (run through valgrind to see the invalid writes):
#include <stdio.h>
#include <string.h>
#include "../elfutils/libebl/libebl.h"
int main (void) {
#define X 4032
char s[X + 1] = {0};
memset (s, '.', X);
struct Ebl_Strtab *t = ebl_strtabinit (false);
ebl_strtabadd (t, s, 0);
}
For long strings, the allocation was inefficient because the length of
string was used directly, instead of rounding it up to the nearest page
size.
Both is now fixed on the pmachata/libebl-long-strings branch. Please
review.
PM
Show replies by date
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I merged the branch.
- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora -
http://enigmail.mozdev.org/
iEYEARECAAYFAkqf17IACgkQ2ijCOnn/RHT1EwCfRe87HL11EvDgKxCYWF7O+Jwl
wvYAoJVO7A4J4nhi6Ib6uWFf9ZMuQUl0
=vpIB
-----END PGP SIGNATURE-----