fontconfig: Branch 'main' - 3 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed May 7 12:49:42 UTC 2025
src/fccharset.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 005649e365c71a1f7570dd951cc40392190a6d2e
Merge: 752eb3d 1e2f51d
Author: Akira TAGOH <akira at tagoh.org>
Date: Wed May 7 12:49:40 2025 +0000
Merge branch 'fgh-fix-may25' into 'main'
fccharset.c Avoid use-after-free warning
See merge request fontconfig/fontconfig!401
commit 1e2f51d6ae0dcb040825f738aa497ac8b8ff2fe5
Author: Federico Gallo Herosa <federico.gallo.herosa at gmail.com>
Date: Tue May 6 06:39:54 2025 -0300
fccharset.c Avoid use-after-free warning
Recalculate each offset instead of adjusting with _distance_ variable now removed.
*Notice* that this change doesn't make the issue go away, it just make it visible
when build type is debug.
diff --git a/src/fccharset.c b/src/fccharset.c
index f55c0ba..67d4c94 100644
--- a/src/fccharset.c
+++ b/src/fccharset.c
@@ -189,6 +189,7 @@ FcCharSetPutLeaf (FcCharSet *fcs,
return FcFalse;
}
for (i = 0; i < fcs->num; i++) {
+ // Reconstruct FcCharLeaf* from offset, similar to how FcCharSetLeaf() macro operates
FcCharLeaf *leaf = FcOffsetToPtr (leaves, new_leaves[i], FcCharLeaf);
new_leaves[i] = FcPtrToOffset (new_leaves, leaf);
}
commit cff25b10e2ff9286d9c854093d4593c22ebd3baa
Author: Federico Gallo Herosa <federico.gallo.herosa at gmail.com>
Date: Mon May 5 05:54:45 2025 -0300
fccharset.c Avoid use-after-free warning
Recalculate each offset instead of adjusting with _distance_ variable now removed.
*Notice* that this change doesn't make the issue go away, it just make it visible
when build type is debug.
diff --git a/src/fccharset.c b/src/fccharset.c
index 21a328f..f55c0ba 100644
--- a/src/fccharset.c
+++ b/src/fccharset.c
@@ -169,7 +169,6 @@ FcCharSetPutLeaf (FcCharSet *fcs,
int i;
unsigned int alloced = fcs->num;
intptr_t *new_leaves;
- ptrdiff_t distance;
alloced *= 2;
numbers = realloc (numbers, alloced * sizeof (*numbers));
@@ -189,9 +188,9 @@ FcCharSetPutLeaf (FcCharSet *fcs,
fcs->numbers_offset = FcPtrToOffset (fcs, numbers);
return FcFalse;
}
- distance = (char *)new_leaves - (char *)leaves;
for (i = 0; i < fcs->num; i++) {
- new_leaves[i] -= distance;
+ FcCharLeaf *leaf = FcOffsetToPtr (leaves, new_leaves[i], FcCharLeaf);
+ new_leaves[i] = FcPtrToOffset (new_leaves, leaf);
}
leaves = new_leaves;
}
More information about the Fontconfig
mailing list