summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-07-20 22:52:06 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-07-20 22:52:06 (GMT)
commit715a63b78349952ccc0fb3dd3139e2d822006d35 (patch)
treed1474f149df204365adc6c07ba57469753124145 /Objects
parentbee739baa771b7c54169e799fbfe1a55c5fce3d6 (diff)
downloadcpython-715a63b78349952ccc0fb3dd3139e2d822006d35.zip
cpython-715a63b78349952ccc0fb3dd3139e2d822006d35.tar.gz
cpython-715a63b78349952ccc0fb3dd3139e2d822006d35.tar.bz2
Issue #14579: Fix error handling bug in the utf-16 decoder.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 7af7b50..59b138a 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -2564,7 +2564,7 @@ PyUnicode_DecodeUTF16Stateful(const char *s,
}
/* UTF-16 code pair: */
- if (q >= e) {
+ if (e - q < 2) {
errmsg = "unexpected end of data";
startinpos = (((const char *)q)-2)-starts;
endinpos = ((const char *)e)-starts;