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

Side by Side Diff: Objects/unicodeobject.c

Issue 20538: Segfault in UTF-7 incremental decoder
Patch Set: Created 5 years, 7 months 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 4441 matching lines...) Expand 10 before | Expand all | Expand 10 after
4452 &writer)) 4452 &writer))
4453 goto onError; 4453 goto onError;
4454 if (s < e) 4454 if (s < e)
4455 goto restart; 4455 goto restart;
4456 } 4456 }
4457 } 4457 }
4458 4458
4459 /* return state */ 4459 /* return state */
4460 if (consumed) { 4460 if (consumed) {
4461 if (inShift) { 4461 if (inShift) {
4462 *consumed = startinpos;
4463 if (writer.pos != shiftOutStart && writer.maxchar > 127) {
4464 PyObject *result = PyUnicode_FromKindAndData(
4465 writer.kind, writer.data, shiftOutStart);
4466 Py_XDECREF(errorHandler);
4467 Py_XDECREF(exc);
4468 _PyUnicodeWriter_Dealloc(&writer);
4469 return result;
4470 }
4462 writer.pos = shiftOutStart; /* back off output */ 4471 writer.pos = shiftOutStart; /* back off output */
4463 *consumed = startinpos;
4464 } 4472 }
4465 else { 4473 else {
4466 *consumed = s-starts; 4474 *consumed = s-starts;
4467 } 4475 }
4468 } 4476 }
4469 4477
4470 Py_XDECREF(errorHandler); 4478 Py_XDECREF(errorHandler);
4471 Py_XDECREF(exc); 4479 Py_XDECREF(exc);
4472 return _PyUnicodeWriter_Finish(&writer); 4480 return _PyUnicodeWriter_Finish(&writer);
4473 4481
(...skipping 10935 matching lines...) Expand 10 before | Expand all | Expand 10 after
15409 PyMODINIT_FUNC 15417 PyMODINIT_FUNC
15410 PyInit__string(void) 15418 PyInit__string(void)
15411 { 15419 {
15412 return PyModule_Create(&_string_module); 15420 return PyModule_Create(&_string_module);
15413 } 15421 }
15414 15422
15415 15423
15416 #ifdef __cplusplus 15424 #ifdef __cplusplus
15417 } 15425 }
15418 #endif 15426 #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+