mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Fix out-of-bounds memory access in font_ttf_get_glyph
FT_GlyphSlot.bitmap_left can be negative.
This commit is contained in:
@@ -141,11 +141,15 @@ static void font_ttf_sel_font(int type, int size) {
|
||||
}
|
||||
|
||||
static void pixmap2comimg(BYTE *src, int x, int y, int w, int h, int src_bpl) {
|
||||
int yy;
|
||||
if (x < 0) {
|
||||
w += x;
|
||||
src -= x;
|
||||
x = 0;
|
||||
}
|
||||
BYTE *dst = GETOFFSET_PIXEL(&img_glyph, x, y);
|
||||
if (w <= 0) return;
|
||||
|
||||
for (yy = 0; yy < h; yy++) {
|
||||
for (int yy = 0; yy < h; yy++) {
|
||||
memcpy(dst, src, w);
|
||||
src += src_bpl;
|
||||
dst += img_glyph.bytes_per_line;
|
||||
|
||||
Reference in New Issue
Block a user