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
55c9239a
Commit
55c9239a
authored
Oct 01, 2016
by
Martin Panter
Browse files
Options
Browse Files
Download
Plain Diff
Issue #28275: Merge bz2 fix from 3.5 into 3.6
parents
ef223a19
38317d33
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
7 deletions
+14
-7
Lib/test/test_bz2.py
Lib/test/test_bz2.py
+6
-0
Lib/test/test_lzma.py
Lib/test/test_lzma.py
+3
-5
Misc/NEWS
Misc/NEWS
+2
-1
Modules/_bz2module.c
Modules/_bz2module.c
+3
-1
No files found.
Lib/test/test_bz2.py
View file @
55c9239a
...
@@ -821,6 +821,12 @@ class BZ2DecompressorTest(BaseTest):
...
@@ -821,6 +821,12 @@ class BZ2DecompressorTest(BaseTest):
out
.
append
(
bzd
.
decompress
(
self
.
DATA
[
300
:]))
out
.
append
(
bzd
.
decompress
(
self
.
DATA
[
300
:]))
self
.
assertEqual
(
b''
.
join
(
out
),
self
.
TEXT
)
self
.
assertEqual
(
b''
.
join
(
out
),
self
.
TEXT
)
def
test_failure
(
self
):
bzd
=
BZ2Decompressor
()
self
.
assertRaises
(
Exception
,
bzd
.
decompress
,
self
.
BAD_DATA
*
30
)
# Previously, a second call could crash due to internal inconsistency
self
.
assertRaises
(
Exception
,
bzd
.
decompress
,
self
.
BAD_DATA
*
30
)
class
CompressDecompressTest
(
BaseTest
):
class
CompressDecompressTest
(
BaseTest
):
def
testCompress
(
self
):
def
testCompress
(
self
):
data
=
bz2
.
compress
(
self
.
TEXT
)
data
=
bz2
.
compress
(
self
.
TEXT
)
...
...
Lib/test/test_lzma.py
View file @
55c9239a
...
@@ -249,11 +249,9 @@ class CompressorDecompressorTestCase(unittest.TestCase):
...
@@ -249,11 +249,9 @@ class CompressorDecompressorTestCase(unittest.TestCase):
def
test_decompressor_bug_28275
(
self
):
def
test_decompressor_bug_28275
(
self
):
# Test coverage for Issue 28275
# Test coverage for Issue 28275
lzd
=
LZMADecompressor
()
lzd
=
LZMADecompressor
()
for
i
in
range
(
2
):
self
.
assertRaises
(
LZMAError
,
lzd
.
decompress
,
COMPRESSED_RAW_1
)
try
:
# Previously, a second call could crash due to internal inconsistency
lzd
.
decompress
(
COMPRESSED_RAW_1
)
self
.
assertRaises
(
LZMAError
,
lzd
.
decompress
,
COMPRESSED_RAW_1
)
except
LZMAError
:
pass
# Test that LZMACompressor->LZMADecompressor preserves the input data.
# Test that LZMACompressor->LZMADecompressor preserves the input data.
...
...
Misc/NEWS
View file @
55c9239a
...
@@ -67,7 +67,8 @@ Library
...
@@ -67,7 +67,8 @@ Library
that they don'
t
call
itermonthdates
()
which
can
cause
datetime
.
date
that they don'
t
call
itermonthdates
()
which
can
cause
datetime
.
date
under
/
overflow
.
under
/
overflow
.
-
Issue
#
28275
:
Fixed
possible
use
adter
free
in
LZMADecompressor
.
decompress
().
-
Issue
#
28275
:
Fixed
possible
use
after
free
in
the
decompress
()
methods
of
the
LZMADecompressor
and
BZ2Decompressor
classes
.
Original
patch
by
John
Leitch
.
Original
patch
by
John
Leitch
.
-
Issue
#
27897
:
Fixed
possible
crash
in
sqlite3
.
Connection
.
create_collation
()
-
Issue
#
27897
:
Fixed
possible
crash
in
sqlite3
.
Connection
.
create_collation
()
...
...
Modules/_bz2module.c
View file @
55c9239a
...
@@ -534,8 +534,10 @@ decompress(BZ2Decompressor *d, char *data, size_t len, Py_ssize_t max_length)
...
@@ -534,8 +534,10 @@ decompress(BZ2Decompressor *d, char *data, size_t len, Py_ssize_t max_length)
}
}
result
=
decompress_buf
(
d
,
max_length
);
result
=
decompress_buf
(
d
,
max_length
);
if
(
result
==
NULL
)
if
(
result
==
NULL
)
{
bzs
->
next_in
=
NULL
;
return
NULL
;
return
NULL
;
}
if
(
d
->
eof
)
{
if
(
d
->
eof
)
{
d
->
needs_input
=
0
;
d
->
needs_input
=
0
;
...
...
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