Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
016a3f33
Commit
016a3f33
authored
Feb 08, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #20538: UTF-7 incremental decoder produced inconsistant string when
input was truncated in BASE64 section.
parent
1e949890
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
7 deletions
+45
-7
Lib/test/test_codecs.py
Lib/test/test_codecs.py
+33
-6
Misc/NEWS
Misc/NEWS
+3
-0
Objects/unicodeobject.c
Objects/unicodeobject.c
+9
-1
No files found.
Lib/test/test_codecs.py
View file @
016a3f33
...
...
@@ -852,13 +852,40 @@ class UTF7Test(ReadTest, unittest.TestCase):
def
test_partial
(
self
):
self
.
check_partial
(
"a+-b"
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e
\
U00010000
f'
,
[
"a"
,
"a"
,
"a+"
,
"a+-"
,
"a+-b"
,
'a'
,
'a'
,
'a+'
,
'a+-'
,
'a+-b'
,
'a+-b'
,
'a+-b'
,
'a+-b'
,
'a+-b'
,
'a+-b
\
x00
'
,
'a+-b
\
x00
c'
,
'a+-b
\
x00
c'
,
'a+-b
\
x00
c'
,
'a+-b
\
x00
c'
,
'a+-b
\
x00
c'
,
'a+-b
\
x00
c
\
x80
'
,
'a+-b
\
x00
c
\
x80
d'
,
'a+-b
\
x00
c
\
x80
d'
,
'a+-b
\
x00
c
\
x80
d'
,
'a+-b
\
x00
c
\
x80
d'
,
'a+-b
\
x00
c
\
x80
d'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e
\
U00010000
'
,
'a+-b
\
x00
c
\
x80
d
\
u0100
e
\
U00010000
f'
,
]
)
...
...
Misc/NEWS
View file @
016a3f33
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.3.4 release candidate 1?
Core and Builtins
-----------------
- Issue #20538: UTF-7 incremental decoder produced inconsistant string when
input was truncated in BASE64 section.
- Issue #17825: Cursor "^" is correctly positioned for SyntaxError and
IndentationError.
...
...
Objects/unicodeobject.c
View file @
016a3f33
...
...
@@ -4474,8 +4474,16 @@ utf7Error:
/* return state */
if
(
consumed
)
{
if
(
inShift
)
{
outpos
=
shiftOutStart
;
/* back off output */
*
consumed
=
startinpos
;
if
(
outpos
!=
shiftOutStart
&&
PyUnicode_MAX_CHAR_VALUE
(
unicode
)
>
127
)
{
PyObject
*
result
=
PyUnicode_FromKindAndData
(
PyUnicode_KIND
(
unicode
),
PyUnicode_DATA
(
unicode
),
shiftOutStart
);
Py_DECREF
(
unicode
);
unicode
=
result
;
}
outpos
=
shiftOutStart
;
/* back off output */
}
else
{
*
consumed
=
s
-
starts
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment