[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] ftbench-gsoc-goksu 3734286 10/17: Correct type of icon
From: |
Werner Lemberg |
Subject: |
[freetype2-demos] ftbench-gsoc-goksu 3734286 10/17: Correct type of icon_span |
Date: |
Sat, 20 May 2023 08:29:42 -0400 (EDT) |
branch: ftbench-gsoc-goksu
commit 37342861502be27dfd7a8490f5af45675bf86d11
Author: Ben Wagner <bungeman@chromium.org>
Commit: Ben Wagner <bungeman@chromium.org>
Correct type of icon_span
The `icon_span` is used as a `FT_SpanFunc`. To avoid undefined behavior
and a CFI sanitizer report, this function needs to called through a
pointer of the same type. Fix this by making `icon_span` take the right
parameter types and cast the argument in the function body.
* src/ftcommon.c (icon_span): take correct parameters and cast in
function body. (FTDemo_Icon): remove cast
---
src/ftcommon.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/ftcommon.c b/src/ftcommon.c
index b090141..b4e860d 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -467,8 +467,9 @@
icon_span( int y,
int count,
const FT_Span* spans,
- grBitmap* icon )
+ void* user )
{
+ grBitmap* icon = (grBitmap*)user;
FT_UInt32* dst_line;
FT_UInt32* dst;
FT_UInt32 color = 0xFF7F00;
@@ -508,7 +509,7 @@
FT_Raster_Params params = { NULL, NULL,
FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT,
- (FT_SpanFunc)icon_span, NULL, NULL, NULL,
+ icon_span, NULL, NULL, NULL,
&icon, { 0, 0, 0, 0 } };
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] ftbench-gsoc-goksu 3734286 10/17: Correct type of icon_span,
Werner Lemberg <=