File fontforge-fix-crash-for-content-over-32767-characters-in-GDraw.patch of Package fontforge
From 0df57ac0d44fbe668f33a57593f94ba6c987a440 Mon Sep 17 00:00:00 2001
From: Maxim Iorsh <iorsh@users.sourceforge.net>
Date: Tue, 13 Jan 2026 19:10:56 +0200
Subject: [PATCH] Fix crash for content over 32767 characters in GDraw
multiline text field (#5728)
---
gdraw/ggadgetP.h | 12 ++++++------
gdraw/gtextfield.c | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/gdraw/ggadgetP.h b/gdraw/ggadgetP.h
index 85b67ea06..b2115fc90 100644
--- a/gdraw/ggadgetP.h
+++ b/gdraw/ggadgetP.h
@@ -314,19 +314,19 @@ typedef struct gtextfield {
uint8_t fh;
uint8_t as;
uint8_t nw; /* Width of one character (an "n") */
- int16_t xoff_left, loff_top;
- int16_t sel_start, sel_end, sel_base;
- int16_t sel_oldstart, sel_oldend, sel_oldbase;
- int16_t dd_cursor_pos;
+ int32_t xoff_left, loff_top;
+ int32_t sel_start, sel_end, sel_base;
+ int32_t sel_oldstart, sel_oldend, sel_oldbase;
+ int32_t dd_cursor_pos;
unichar_t *text, *oldtext;
FontInstance *font;
GTimer *pressed;
GTimer *cursor;
GCursor old_cursor;
GScrollBar *hsb, *vsb;
- int16_t lcnt, lmax;
+ int32_t lcnt, lmax;
int32_t *lines; /* offsets in text to the start of the nth line */
- int16_t xmax;
+ int32_t xmax;
GIC *gic;
GTimer *numeric_scroll;
char *utf8_text; /* For Pango */
diff --git a/gdraw/gtextfield.c b/gdraw/gtextfield.c
index 19b16274c..f56a9d6a6 100644
--- a/gdraw/gtextfield.c
+++ b/gdraw/gtextfield.c
@@ -633,7 +633,7 @@ static int GTextFieldSelForeword(unichar_t *text,int end) {
return( end );
}
-static void GTextFieldSelectWord(GTextField *gt,int mid, int16_t *start, int16_t *end) {
+static void GTextFieldSelectWord(GTextField *gt,int mid, int32_t *start, int32_t *end) {
unichar_t *text;
unichar_t ch = gt->text[mid];
@@ -664,7 +664,7 @@ static void GTextFieldSelectWord(GTextField *gt,int mid, int16_t *start, int16_t
}
static void GTextFieldSelectWords(GTextField *gt,int last) {
- int16_t ss, se;
+ int32_t ss, se;
GTextFieldSelectWord(gt,gt->sel_base,>->sel_start,>->sel_end);
if ( last!=gt->sel_base ) {
GTextFieldSelectWord(gt,last,&ss,&se);
@@ -2185,7 +2185,7 @@ static void gtextfield_redraw(GGadget *g) {
static void gtextfield_move(GGadget *g, int32_t x, int32_t y ) {
GTextField *gt = (GTextField *) g;
- int fxo=0, fyo=0, bxo, byo;
+ int fxo=0, fyo=0, bxo=0, byo=0;
if ( gt->listfield || gt->numericfield ) {
fxo = ((GListField *) gt)->fieldrect.x - g->r.x;
@@ -2209,7 +2209,7 @@ static void gtextfield_move(GGadget *g, int32_t x, int32_t y ) {
static void gtextfield_resize(GGadget *g, int32_t width, int32_t height ) {
GTextField *gt = (GTextField *) g;
int gtwidth=width, gtheight=height, oldheight=0;
- int fxo=0, fwo=0, fyo=0, bxo, byo;
+ int fxo=0, fwo=0, fyo=0, bxo=0, byo=0;
int l;
if ( gt->listfield || gt->numericfield ) {
--
2.49.0