]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #17043: The unicode-internal decoder no longer read past the end of
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 7 Feb 2013 14:26:55 +0000 (16:26 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 7 Feb 2013 14:26:55 +0000 (16:26 +0200)
input buffer.

1  2 
Misc/NEWS
Objects/unicodeobject.c

diff --cc Misc/NEWS
Simple merge
index cbd2870c1d73ae421af93f0cecbcad5b043d91ab,abe793dfd4870859b8dc313af323d8ef3c4d5ef5..8596e544233ee5311f2b702fe6e1f77d8ec17cc6
@@@ -6028,18 -6141,28 +6014,28 @@@ _PyUnicode_DecodeUnicodeInternal(const 
          }
  #endif
  
 -        if (unicode_putchar(&v, &outpos, ch) < 0)
 +        if (_PyUnicodeWriter_Prepare(&writer, 1, ch) == -1)
              goto onError;
 -        if (unicode_decode_call_errorhandler(
 +        PyUnicode_WRITE(writer.kind, writer.data, writer.pos, ch);
 +        writer.pos++;
+         continue;
+   error:
+         startinpos = s - starts;
 -                &v, &outpos))
++        if (unicode_decode_call_errorhandler_writer(
+                 errors, &errorHandler,
+                 "unicode_internal", reason,
+                 &starts, &end, &startinpos, &endinpos, &exc, &s,
++                &writer))
+             goto onError;
      }
  
 -    if (unicode_resize(&v, outpos) < 0)
 -        goto onError;
      Py_XDECREF(errorHandler);
      Py_XDECREF(exc);
 -    return unicode_result(v);
 +    return _PyUnicodeWriter_Finish(&writer);
  
    onError:
 -    Py_XDECREF(v);
 +    _PyUnicodeWriter_Dealloc(&writer);
      Py_XDECREF(errorHandler);
      Py_XDECREF(exc);
      return NULL;