|
From: Jerome F. <kin...@us...> - 2011-03-11 11:28:44
|
Update of /cvsroot/munt/mt32emu_alsadrv/src
In directory vz-cvs-4.sog:/tmp/cvs-serv15845
Modified Files:
lcd.cpp pixmaps.cpp
Log Message:
Applied patch from Munt bug #2921570:
xmt32 causes a segmentation fault (null pointer dereference) when using an xfont for which the per_char pointer is NULL. The attached patch fixes this problem,
Index: lcd.cpp
===================================================================
RCS file: /cvsroot/munt/mt32emu_alsadrv/src/lcd.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** lcd.cpp 19 Dec 2004 23:30:51 -0000 1.1
--- lcd.cpp 11 Mar 2011 11:28:42 -0000 1.2
***************
*** 86,91 ****
if (!c)
break;
! nw = lcd_flagfont->per_char[c].width;
! nh = lcd_flagfont->per_char[c].ascent + lcd_flagfont->per_char[c].descent;
if (nw > w) w = nw;
--- 86,100 ----
if (!c)
break;
! /* From xfontstruct man page: "If the per_char pointer is NULL, all glyphs between the
! first and last character indexes inclusive have the same information, as given by both
! min_bounds and max_bounds." */
! if (lcd_flagfont->per_char == NULL)
! {
! nw = lcd_flagfont->max_bounds.width;
! nh = lcd_flagfont->max_bounds.ascent + lcd_flagfont->max_bounds.descent;
! } else {
! nw = lcd_flagfont->per_char[c].width;
! nh = lcd_flagfont->per_char[c].ascent + lcd_flagfont->per_char[c].descent;
! }
if (nw > w) w = nw;
Index: pixmaps.cpp
===================================================================
RCS file: /cvsroot/munt/mt32emu_alsadrv/src/pixmaps.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pixmaps.cpp 19 Dec 2004 23:30:51 -0000 1.1
--- pixmaps.cpp 11 Mar 2011 11:28:42 -0000 1.2
***************
*** 72,77 ****
c = txt[i];
! w += fs->per_char[c].width;
! nh = fs->per_char[c].ascent; // + fs->per_char[c].descent;
if (nh > h)
--- 72,87 ----
c = txt[i];
!
! /* From xfontstruct man page: "If the per_char pointer is NULL, all glyphs between the
! first and last character indexes inclusive have the same information, as given by both
! min_bounds and max_bounds." */
! if (fs->per_char == NULL)
! {
! w += fs->max_bounds.width;
! nh = fs->max_bounds.ascent; // + fs->max_bounds.descent;
! } else {
! w += fs->per_char[c].width;
! nh = fs->per_char[c].ascent; // + fs->per_char[c].descent;
! }
if (nh > h)
|