Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(10)

Side by Side Diff: Objects/unicodeobject.c

Issue 20538: Segfault in UTF-7 incremental decoder
Patch Set: Created 6 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_codecs.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 2
3 Unicode implementation based on original code by Fredrik Lundh, 3 Unicode implementation based on original code by Fredrik Lundh,
4 modified by Marc-Andre Lemburg <mal@lemburg.com>. 4 modified by Marc-Andre Lemburg <mal@lemburg.com>.
5 5
6 Major speed upgrades to the method implementations at the Reykjavik 6 Major speed upgrades to the method implementations at the Reykjavik
7 NeedForSpeed sprint, by Fredrik Lundh and Andrew Dalke. 7 NeedForSpeed sprint, by Fredrik Lundh and Andrew Dalke.
8 8
9 Copyright (c) Corporation for National Research Initiatives. 9 Copyright (c) Corporation for National Research Initiatives.
10 10
(...skipping 4456 matching lines...) Expand 10 before | Expand all | Expand 10 after
4467 &unicode, &outpos)) 4467 &unicode, &outpos))
4468 goto onError; 4468 goto onError;
4469 if (s < e) 4469 if (s < e)
4470 goto restart; 4470 goto restart;
4471 } 4471 }
4472 } 4472 }
4473 4473
4474 /* return state */ 4474 /* return state */
4475 if (consumed) { 4475 if (consumed) {
4476 if (inShift) { 4476 if (inShift) {
4477 *consumed = startinpos;
4478 if (outpos != shiftOutStart &&
4479 PyUnicode_MAX_CHAR_VALUE(unicode) > 127) {
4480 PyObject *result = PyUnicode_FromKindAndData(
4481 PyUnicode_KIND(unicode), PyUnicode_DATA(unicode),
4482 shiftOutStart);
4483 Py_DECREF(unicode);
4484 unicode = result;
4485 }
4477 outpos = shiftOutStart; /* back off output */ 4486 outpos = shiftOutStart; /* back off output */
4478 *consumed = startinpos;
4479 } 4487 }
4480 else { 4488 else {
4481 *consumed = s-starts; 4489 *consumed = s-starts;
4482 } 4490 }
4483 } 4491 }
4484 4492
4485 if (unicode_resize(&unicode, outpos) < 0) 4493 if (unicode_resize(&unicode, outpos) < 0)
4486 goto onError; 4494 goto onError;
4487 4495
4488 Py_XDECREF(errorHandler); 4496 Py_XDECREF(errorHandler);
(...skipping 10145 matching lines...) Expand 10 before | Expand all | Expand 10 after
14634 PyMODINIT_FUNC 14642 PyMODINIT_FUNC
14635 PyInit__string(void) 14643 PyInit__string(void)
14636 { 14644 {
14637 return PyModule_Create(&_string_module); 14645 return PyModule_Create(&_string_module);
14638 } 14646 }
14639 14647
14640 14648
14641 #ifdef __cplusplus 14649 #ifdef __cplusplus
14642 } 14650 }
14643 #endif 14651 #endif
OLDNEW
« no previous file with comments | « Lib/test/test_codecs.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+