diff options
| author | Paul Eggert | 2024-04-30 01:20:13 -0700 |
|---|---|---|
| committer | Paul Eggert | 2024-04-30 01:26:24 -0700 |
| commit | 59a11116e013fb123ba074da9bca373c1aa03367 (patch) | |
| tree | 9cd6a55d352e4dbcd3d08590f014dec446c1a012 /src | |
| parent | 750dbccc12415fe525111cd11811d809fc830610 (diff) | |
| download | emacs-59a11116e013fb123ba074da9bca373c1aa03367.tar.gz emacs-59a11116e013fb123ba074da9bca373c1aa03367.zip | |
Pacify GCC 14 -Wstring-operflow in ftfont.c
* src/ftfont.c (ftfont_drive_otf): Do not crash if
spec->features[i] is nonnull but is empty.
Use gfeatures local to pacify GCC 14.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ftfont.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ftfont.c b/src/ftfont.c index 0d10de5408f..2e37b62ea35 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -2030,7 +2030,6 @@ ftfont_drive_otf (MFLTFont *font, | |||
| 2030 | int i, j, gidx; | 2030 | int i, j, gidx; |
| 2031 | OTF_Glyph *otfg; | 2031 | OTF_Glyph *otfg; |
| 2032 | char script[5], *langsys = NULL; | 2032 | char script[5], *langsys = NULL; |
| 2033 | char *gsub_features = NULL, *gpos_features = NULL; | ||
| 2034 | OTF_Feature *features; | 2033 | OTF_Feature *features; |
| 2035 | 2034 | ||
| 2036 | if (len == 0) | 2035 | if (len == 0) |
| @@ -2044,6 +2043,7 @@ ftfont_drive_otf (MFLTFont *font, | |||
| 2044 | OTF_tag_name (spec->langsys, langsys); | 2043 | OTF_tag_name (spec->langsys, langsys); |
| 2045 | } | 2044 | } |
| 2046 | 2045 | ||
| 2046 | char *gfeatures[2] = {NULL, NULL}; | ||
| 2047 | USE_SAFE_ALLOCA; | 2047 | USE_SAFE_ALLOCA; |
| 2048 | for (i = 0; i < 2; i++) | 2048 | for (i = 0; i < 2; i++) |
| 2049 | { | 2049 | { |
| @@ -2052,11 +2052,10 @@ ftfont_drive_otf (MFLTFont *font, | |||
| 2052 | if (spec->features[i] && spec->features[i][1] != 0xFFFFFFFF) | 2052 | if (spec->features[i] && spec->features[i][1] != 0xFFFFFFFF) |
| 2053 | { | 2053 | { |
| 2054 | for (j = 0; spec->features[i][j]; j++); | 2054 | for (j = 0; spec->features[i][j]; j++); |
| 2055 | if (j == 0) | ||
| 2056 | continue; | ||
| 2055 | SAFE_NALLOCA (p, 6, j); | 2057 | SAFE_NALLOCA (p, 6, j); |
| 2056 | if (i == 0) | 2058 | gfeatures[i] = p; |
| 2057 | gsub_features = p; | ||
| 2058 | else | ||
| 2059 | gpos_features = p; | ||
| 2060 | for (j = 0; spec->features[i][j]; j++) | 2059 | for (j = 0; spec->features[i][j]; j++) |
| 2061 | { | 2060 | { |
| 2062 | if (spec->features[i][j] == 0xFFFFFFFF) | 2061 | if (spec->features[i][j] == 0xFFFFFFFF) |
| @@ -2071,6 +2070,7 @@ ftfont_drive_otf (MFLTFont *font, | |||
| 2071 | *--p = '\0'; | 2070 | *--p = '\0'; |
| 2072 | } | 2071 | } |
| 2073 | } | 2072 | } |
| 2073 | char *gsub_features = gfeatures[0], *gpos_features = gfeatures[1]; | ||
| 2074 | 2074 | ||
| 2075 | setup_otf_gstring (len); | 2075 | setup_otf_gstring (len); |
| 2076 | for (i = 0; i < len; i++) | 2076 | for (i = 0; i < len; i++) |