aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Gramiak2019-05-21 14:58:59 -0600
committerAlexander Gramiak2019-05-21 15:11:23 -0600
commit5a024b72c50129cc429bc4b8b18b8c08f3f6b430 (patch)
treec3e78e17665135b514f2ad32c6166c488600102e /src
parent9624f609493da7c08016ba00d6895bad0fe26a0e (diff)
downloademacs-5a024b72c50129cc429bc4b8b18b8c08f3f6b430.tar.gz
emacs-5a024b72c50129cc429bc4b8b18b8c08f3f6b430.zip
* src/xfont.c (xfont_draw): Allocate the XChar2b array (Bug#35814)
Diffstat (limited to 'src')
-rw-r--r--src/xfont.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/xfont.c b/src/xfont.c
index a402f770630..81808e7a62e 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -1047,11 +1047,16 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1047 } 1047 }
1048 else 1048 else
1049 { 1049 {
1050 const unsigned code = s->char2b[from]; 1050 USE_SAFE_ALLOCA;
1051 const XChar2b char2b = { .byte1 = code >> 8, 1051 const unsigned *code = s->char2b + from;
1052 .byte2 = code & 0xFF }; 1052 XChar2b *char2b;
1053 SAFE_NALLOCA (char2b, 1, len);
1054 for (int i = 0; i < len; ++i)
1055 char2b[i] = (XChar2b) { .byte1 = code[i] >> 8,
1056 .byte2 = code[i] & 0xFF };
1053 XDrawImageString16 (display, FRAME_X_DRAWABLE (s->f), 1057 XDrawImageString16 (display, FRAME_X_DRAWABLE (s->f),
1054 gc, x, y, &char2b, len); 1058 gc, x, y, char2b, len);
1059 SAFE_FREE ();
1055 } 1060 }
1056 } 1061 }
1057 else 1062 else
@@ -1067,11 +1072,16 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1067 } 1072 }
1068 else 1073 else
1069 { 1074 {
1070 const unsigned code = s->char2b[from]; 1075 USE_SAFE_ALLOCA;
1071 const XChar2b char2b = { .byte1 = code >> 8, 1076 const unsigned *code = s->char2b + from;
1072 .byte2 = code & 0xFF }; 1077 XChar2b *char2b;
1078 SAFE_NALLOCA (char2b, 1, len);
1079 for (int i = 0; i < len; ++i)
1080 char2b[i] = (XChar2b) { .byte1 = code[i] >> 8,
1081 .byte2 = code[i] & 0xFF };
1073 XDrawString16 (display, FRAME_X_DRAWABLE (s->f), 1082 XDrawString16 (display, FRAME_X_DRAWABLE (s->f),
1074 gc, x, y, &char2b, len); 1083 gc, x, y, char2b, len);
1084 SAFE_FREE ();
1075 } 1085 }
1076 } 1086 }
1077 unblock_input (); 1087 unblock_input ();