[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/src ChangeLog ftfont.c
From: |
Jim Meyering |
Subject: |
[Emacs-diffs] emacs/src ChangeLog ftfont.c |
Date: |
Tue, 23 Jun 2009 06:49:21 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Jim Meyering <meyering> 09/06/23 06:49:21
Modified files:
src : ChangeLog ftfont.c
Log message:
Don't dereference NULL upon failed malloc and realloc.
* src/ftfont.c (setup_otf_gstring, ftfont_shape_by_flt): Use xmalloc
and xrealloc (not malloc and realloc), so subsequent heap pointer
dereferences are guaranteed to be valid.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7593&r2=1.7594
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ftfont.c?cvsroot=emacs&r1=1.55&r2=1.56
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7593
retrieving revision 1.7594
diff -u -b -r1.7593 -r1.7594
--- ChangeLog 23 Jun 2009 05:53:56 -0000 1.7593
+++ ChangeLog 23 Jun 2009 06:49:20 -0000 1.7594
@@ -1,3 +1,10 @@
+2009-06-23 Jim Meyering <address@hidden>
+
+ Don't dereference NULL upon failed malloc and realloc
+ * src/ftfont.c (setup_otf_gstring, ftfont_shape_by_flt): Use xmalloc
+ and xrealloc (not malloc and realloc), so subsequent heap pointer
+ dereferences are guaranteed to be valid.
+
2009-06-23 Kenichi Handa <address@hidden>
* emacs.c (main): Call init_font ().
Index: ftfont.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ftfont.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- ftfont.c 23 Jun 2009 05:50:48 -0000 1.55
+++ ftfont.c 23 Jun 2009 06:49:21 -0000 1.56
@@ -1700,12 +1700,12 @@
{
if (otf_gstring.size == 0)
{
- otf_gstring.glyphs = (OTF_Glyph *) malloc (sizeof (OTF_Glyph) * size);
+ otf_gstring.glyphs = (OTF_Glyph *) xmalloc (sizeof (OTF_Glyph) * size);
otf_gstring.size = size;
}
else if (otf_gstring.size < size)
{
- otf_gstring.glyphs = (OTF_Glyph *) realloc (otf_gstring.glyphs,
+ otf_gstring.glyphs = xrealloc (otf_gstring.glyphs,
sizeof (OTF_Glyph) * size);
otf_gstring.size = size;
}
@@ -2037,12 +2037,12 @@
{
gstring.allocated = len * 2;
gstring.glyph_size = sizeof (MFLTGlyph);
- gstring.glyphs = malloc (sizeof (MFLTGlyph) * gstring.allocated);
+ gstring.glyphs = xmalloc (sizeof (MFLTGlyph) * gstring.allocated);
}
else if (gstring.allocated < len * 2)
{
gstring.allocated = len * 2;
- gstring.glyphs = realloc (gstring.glyphs,
+ gstring.glyphs = xrealloc (gstring.glyphs,
sizeof (MFLTGlyph) * gstring.allocated);
}
memset (gstring.glyphs, 0, sizeof (MFLTGlyph) * len);
@@ -2092,7 +2092,7 @@
if (result != -2)
break;
gstring.allocated += gstring.allocated;
- gstring.glyphs = realloc (gstring.glyphs,
+ gstring.glyphs = xrealloc (gstring.glyphs,
sizeof (MFLTGlyph) * gstring.allocated);
}
if (gstring.used > LGSTRING_GLYPH_LEN (lgstring))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/src ChangeLog ftfont.c,
Jim Meyering <=