Skip to content

Commit dc8ec78

Browse files
committed
Fixes in Rotated.cxx
1. Clear all members in RotatedTextItem_t via memset(item, 0). Otherwise some values like fXimage can stay uninitialized. 2. When create pixmap, provide at least size 1 x 1 - otherwise X11 server may complain
1 parent b49201a commit dc8ec78

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

graf2d/x11/src/Rotated.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,8 @@ static RotatedTextItem_t *XRotCreateTextItem(Display *dpy, XFontStruct *font, fl
813813
RotatedTextItem_t *item = (RotatedTextItem_t *)malloc((unsigned)sizeof(RotatedTextItem_t));
814814
if(!item) return nullptr;
815815

816+
memset(item, 0, sizeof(RotatedTextItem_t));
817+
816818
/* count number of sections in string */
817819
item->fNl=1;
818820
if(align!=NONE)
@@ -868,7 +870,7 @@ static RotatedTextItem_t *XRotCreateTextItem(Display *dpy, XFontStruct *font, fl
868870

869871
/* bitmap for drawing on */
870872
canvas=XCreatePixmap(dpy, DefaultRootWindow(dpy),
871-
item->fColsIn, item->fRowsIn, 1);
873+
item->fColsIn > 0 ? item->fColsIn : 1, item->fRowsIn, 1);
872874

873875
/* create a GC for the bitmap */
874876
font_gc = XCreateGC(dpy, canvas, 0, nullptr);

0 commit comments

Comments
 (0)