On Mon, 2012-05-28 at 22:49 +0200, Riccardo Magliocchetti wrote:
> ==27901== at 0x13B030C8: FcConfigFileExists (fccfg.c:1671)
This is sadly one of the bogus errors with some fast strlen impl knowing
the malloc chunk is really in hunks of 4 bytes or sommat. I patch my
local fontconfig with this backport from head/latest fontconfig so I
don't have to write suppression files or keep seeing it
> ==27901== Conditional jump or move depends on uninitialised value(s)
> ==27901== at 0x13380510: inflateReset2 (inflate.c:157)
ditto I think. I used to see this, but I don't think I do anymore. Might
be silenced by default in my system valgrind supression files, or maybe
silenced in latest zlib.
C.
diff -ru fontconfig-2.8.0.orig/src/fccfg.c fontconfig-2.8.0/src/fccfg.c
--- fontconfig-2.8.0.orig/src/fccfg.c 2011-03-23 09:08:06.277208441 +0000
+++ fontconfig-2.8.0/src/fccfg.c 2011-03-23 09:47:40.313889413 +0000
@@ -1646,10 +1646,19 @@
FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
{
FcChar8 *path;
+ int size;
if (!dir)
dir = (FcChar8 *) "";
- path = malloc (strlen ((char *) dir) + 1 + strlen ((char *) file) + 1);
+
+ size = strlen ((char *) dir) + 1 + strlen ((char *) file) + 1;
+ /*
+ * workaround valgrind warning because glibc takes advantage of how it knows memory is
+ * allocated to implement strlen by reading in groups of 4
+ */
+ size = (size + 3) & ~3;
+
+ path = malloc (size);
if (!path)
return 0;
@@ -1668,7 +1677,7 @@
#endif
strcat ((char *) path, (char *) file);
- FcMemAlloc (FC_MEM_STRING, strlen ((char *) path) + 1);
+ FcMemAlloc (FC_MEM_STRING, size);
if (access ((char *) path, R_OK) == 0)
return path;
diff -ru fontconfig-2.8.0.orig/src/fcpat.c fontconfig-2.8.0/src/fcpat.c
--- fontconfig-2.8.0.orig/src/fcpat.c 2011-03-23 09:08:06.321208957 +0000
+++ fontconfig-2.8.0/src/fcpat.c 2011-03-23 09:45:08.184116274 +0000
@@ -1057,9 +1057,13 @@
if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1)))
return (FcChar8 *) (b + 1);
size = sizeof (struct objectBucket) + strlen ((char *)name) + 1;
- b = malloc (size + sizeof (int));
- /* workaround glibc bug which reads strlen in groups of 4 */
- FcMemAlloc (FC_MEM_STATICSTR, size + sizeof (int));
+ /*
+ * workaround valgrind warning because glibc takes advantage of how it knows memory is
+ * allocated to implement strlen by reading in groups of 4
+ */
+ size = (size + 3) & ~3;
+ b = malloc (size);
+ FcMemAlloc (FC_MEM_STATICSTR, size);
if (!b)
return NULL;
b->next = 0;
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice