GNOME Bugzilla – Bug 462137
memory corruption in pango_default_break
Last modified: 2007-08-06 11:40:26 UTC
Steps to reproduce: it happens with called with "" empty text. small test: #include <stdio.h> #include <glib.h> #include <pango/pango-types.h> #include <pango/pango-break.h> int main (int argc, char **argv) { PangoLogAttr *attrs = new PangoLogAttr[1]; printf ("before\n"); pango_get_log_attrs ("", 0, -1, NULL, attrs, 1); printf ("after\n"); delete[] attrs; return 0; } originally that bug was spotted in inkscape - http://sourceforge.net/tracker/index.php?func=detail&aid=1715838&group_id=93438&atid=604306 I will attach a patch which should solve that problem. Stack trace: Other information:
Created attachment 92797 [details] [review] proposed patch
Created attachment 92798 [details] valgrind log
Committed patch: --- pango/break.c (revision 2381) +++ pango/break.c (working copy) @@ -558,7 +558,10 @@ pango_default_break (const gchar *text prev_jamo = NO_JAMO; if (length == 0 || *text == '\0') - next_wc = PARAGRAPH_SEPARATOR; + { + next_wc = PARAGRAPH_SEPARATOR; + almost_done = TRUE; + } else next_wc = g_utf8_get_char (next);
2007-07-31 Behdad Esfahbod <behdad@gnome.org> Bug 462137 – memory corruption in pango_default_break * pango/break.c (pango_default_break): Handle the case of an empty string correctly.
*** Bug 463971 has been marked as a duplicate of this bug. ***