[Python-checkins] python/dist/src/Modules unicodedata.c, 2.28, 2.28.10.1

loewis at users.sourceforge.net loewis at users.sourceforge.net
Thu Nov 6 15:47:46 EST 2003


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv3011/Modules

Modified Files:
      Tag: release23-maint
	unicodedata.c 
Log Message:
Overallocate target buffer for normalization more early. Fixes #834676.


Index: unicodedata.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v
retrieving revision 2.28
retrieving revision 2.28.10.1
diff -C2 -d -r2.28 -r2.28.10.1
*** unicodedata.c	28 Feb 2003 03:14:37 -0000	2.28
--- unicodedata.c	6 Nov 2003 20:47:43 -0000	2.28.10.1
***************
*** 312,321 ****
          while(stackptr) {
              Py_UNICODE code = stack[--stackptr];
!             if (!space) {
!                 space = PyString_GET_SIZE(result) + 10;
!                 if (PyUnicode_Resize(&result, space) == -1)
                      return NULL;
!                 o = PyUnicode_AS_UNICODE(result) + space - 10;
!                 space = 10;
              }
              /* Hangul Decomposition. */
--- 312,323 ----
          while(stackptr) {
              Py_UNICODE code = stack[--stackptr];
!             /* Hangul Decomposition adds three characters in
!                a single step, so we need atleast that much room. */
!             if (space < 3) {
!                 int newsize = PyString_GET_SIZE(result) + 10;
!                 space += 10;
!                 if (PyUnicode_Resize(&result, newsize) == -1)
                      return NULL;
!                 o = PyUnicode_AS_UNICODE(result) + newsize - space;
              }
              /* Hangul Decomposition. */





More information about the Python-checkins mailing list