Commit Graph

11748 Commits

Author SHA1 Message Date
stratakis 2149a9ad7a [2.7] bpo-32947: Fixes for TLS 1.3 and OpenSSL 1.1.1 (GH-8761) (GH-11876)
Backport of TLS 1.3 related fixes from 3.7.

Misc fixes and workarounds for compatibility with OpenSSL 1.1.1 from git
master and TLS 1.3 support. With OpenSSL 1.1.1, Python negotiates TLS 1.3 by
default. Some test cases only apply to TLS 1.2.

OpenSSL 1.1.1 has added a new option OP_ENABLE_MIDDLEBOX_COMPAT for TLS
1.3. The feature is enabled by default for maximum compatibility with
broken middle boxes. Users should be able to disable the hack and CPython's test suite needs
it to verify default options

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 2a4ee8aa01)
2019-02-15 18:27:44 +01:00
stratakis b8eaec697a [2.7] bpo-28043: improved default settings for SSLContext (GH-10608)
The options OP_NO_COMPRESSION, OP_CIPHER_SERVER_PREFERENCE,
OP_SINGLE_DH_USE, OP_SINGLE_ECDH_USE, OP_NO_SSLv2 (except
for PROTOCOL_SSLv2), and OP_NO_SSLv3 (except for PROTOCOL_SSLv3)
are set by default. The initial cipher suite list contains only
HIGH ciphers, no NULL ciphers and MD5 ciphers (except for PROTOCOL_SSLv2).

(cherry picked from commit 358cfd426c)
2019-02-15 15:24:11 +01:00
stratakis c49f63c176 [2.7] bpo-33570: TLS 1.3 ciphers for OpenSSL 1.1.1 (GH-6976) (GH-8760) (GH-10607)
Change TLS 1.3 cipher suite settings for compatibility with OpenSSL
1.1.1-pre6 and newer. OpenSSL 1.1.1 will have TLS 1.3 cipers enabled by
default.

Also update multissltests to test with latest OpenSSL.

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 3e630c541b)
Co-authored-by: Christian Heimes <christian@python.org>
2019-02-15 14:17:12 +01:00
Victor Stinner 826a8b7081
bpo-35746: Credit Colin Read and Nicolas Edet (GH-11866)
Add credit for the cert parser vulnerability. Mention also Cisco
TALOS-2018-0758 identifier.
2019-02-15 12:34:17 +01:00
Miss Islington (bot) 06b15424b0
bpo-35746: Fix segfault in ssl's cert parser (GH-11569)
Fix a NULL pointer deref in ssl module. The cert parser did not handle CRL
distribution points with empty DP or URI correctly. A malicious or buggy
certificate can result into segfault.

Signed-off-by: Christian Heimes <christian@python.org>

https://bugs.python.org/issue35746
(cherry picked from commit a37f52436f)

Co-authored-by: Christian Heimes <christian@python.org>
2019-01-15 15:11:52 -08:00
Serhiy Storchaka 1462234baf
[2.7] bpo-8765: Deprecate writing unicode to binary streams in Py3k mode. (GH-11127) 2019-01-15 14:34:48 +02:00
Serhiy Storchaka 555755ecff
[2.7] bpo-35552: Fix reading past the end in PyString_FromFormat(). (GH-11276) (GH-11534)
Format character "%s" in PyString_FromFormat() no longer read memory
past the limit if precision is specified.
(cherry picked from commit d586ccb04f)
2019-01-12 11:20:50 +02:00
Serhiy Storchaka 08a81df050
bpo-33817: Fix _PyString_Resize() and _PyUnicode_Resize() for empty strings. (GH-11515) 2019-01-12 09:22:52 +02:00
Sanyam Khurana 02e33d9567 [2.7] bpo-24746: Avoid stripping trailing whitespace in doctest fancy diff (#11482)
* bpo-24746: Avoid stripping trailing whitespace in doctest fancy diff

* [2.7] bpo-24746: Avoid stripping trailing whitespace in doctest fancy diff (GH-10639).
(cherry picked from commit cbb1645993)

Co-authored-by: Sanyam Khurana <8039608+CuriousLearner@users.noreply.github.com>
2019-01-09 11:03:03 -08:00
Ned Deily c540c4ec61 Revert "bpo-35402: Update macOS installer to use Tcl 8.6.9 / Tk 8.6.9.1 (GH-11101)"
This reverts commit aa58050843.

Due to regressions found with using Tk 8.6.9.1, build the python.org
macOS installers with Tcl/Tk 8.6.8 as used in previous releases.
2018-12-27 15:18:51 -05:00
Myles Borins d9a2aca839 [2.7] bpo-31715 Add mimetype for extension .mjs (GH-3908) (GH-10978)
(cherry picked from 0854b92cd2)
2018-12-20 15:29:34 -05:00
Zackery Spytz f347c6eb75 bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. (GH-11175) (GH-11249)
(cherry picked from commit 842acaab13)
2018-12-20 19:38:52 +02:00
Victor Stinner ea6b322829
bpo-10496: distutils check_environ() handles getpwuid() error (GH-10931) (GH-11213)
check_environ() of distutils.utils now catchs KeyError on calling
pwd.getpwuid(): don't create the HOME environment variable in this
case.

(cherry picked from commit 17d0c0595e)
2018-12-18 17:34:51 +01:00
Victor Stinner 34b7c438b8
bpo-34279: regrtest consider that skipped tests are ran (GH-11132) (GH-11158)
bpo-34279, bpo-35412: support.run_unittest() no longer raises
TestDidNotRun if a test result contains skipped tests. The
exception is now only raised if no test have been run and no test
have been skipped.

(cherry picked from commit 3a8f4fef4a)
2018-12-14 13:44:08 +01:00
Victor Stinner 16d63202af
bpo-16039: CVE-2013-1752: Limit imaplib.IMAP4_SSL.readline() (GH-11120)
* bpo-16039: CVE-2013-1752: Change use of readline() in
  imaplib.IMAP4_SSL to limit line length. Remove IMAP4_SSL.readline()
  and IMAP4_SSL.read() to inherit safe IMAP4 implementation.
* bpo-20118: reenable test_linetoolong() of test_imaplib
  on ThreadedNetworkedTests and ThreadedNetworkedTestsSSL.
  The test now sets the _MAXLINE limit to 10 characters.
2018-12-12 12:05:59 +01:00
Ned Deily d0d09b511d
[2.7] bpo-15663: the 10.6+ macOS installers for 3.6/2.7 now provide a private Tcl/Tk 8.6 (GH-11110) 2018-12-11 04:33:56 -05:00
Miss Islington (bot) aa58050843
bpo-35402: Update macOS installer to use Tcl 8.6.9 / Tk 8.6.9.1 (GH-11101)
(cherry picked from commit 7cf3d8e251)

Co-authored-by: Ned Deily <nad@python.org>
2018-12-10 22:39:34 -08:00
Miss Islington (bot) 55076cc0ff
[3.6] bpo-35401: Update macOS installer to OpenSSL 1.0.2q (GH-11095)
https://bugs.python.org/issue35401
(cherry picked from commit 419b5ffc2c)

Co-authored-by: Ned Deily <nad@python.org>
2018-12-10 21:54:04 -08:00
Steve Dower 3c8bd22b8f
bpo-35401: Updates Windows build to OpenSSL 1.0.2q (GH-11089) 2018-12-10 20:26:33 -08:00
Victor Stinner cecf313d1e
bpo-35052: Fix handler on xml.dom.minidom.cloneNode() (GH-11061) (GH-11068)
Fix xml.dom.minidom cloneNode() on a document with an entity: pass
the correct arguments to the user data handler of an entity (fix an
old copy/paste mistake).

Bug spotted and fix proposed by Charalampos Stratakis, initial
reproducer written by Petr Viktorin.

Co-Authored-By: Charalampos Stratakis <cstratak@redhat.com>
Co-Authored-By: Petr Viktorin <encukou@gmail.com>
(cherry picked from commit 8e04186889)
2018-12-10 11:56:54 +01:00
Victor Stinner 358fc87f53
Revert "[2.7] bpo-34172: multiprocessing.Pool leaks resources after being deleted (GH-9686)" (GH-10970)
This reverts commit 4a7dd30f58.
2018-12-06 01:49:41 +01:00
Serhiy Storchaka fff8fab1ce
[2.7] bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113). (GH-10946) (GH-10955)
(cherry picked from commit 5b25f1d031)
(cherry picked from commit 1de91a0032)

Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>.
2018-12-06 00:21:40 +02:00
Serhiy Storchaka b2742ba5f9
[2.7] bpo-34738: Add directory entries in ZIP files created by distutils. (GH-9419). (GH-10950)
(cherry picked from commit 67a93b3a0b)
2018-12-06 00:02:10 +02:00
Victor Stinner b50b33b4ac
bpo-10496: posixpath.expanduser() catchs pwd.getpwuid() error (GH-10919) (GH-10930)
* posixpath.expanduser() now returns the input path unchanged if
  the HOME environment variable is not set and pwd.getpwuid() raises
  KeyError (the current user identifier doesn't exist in the password
  database).
* Add test_no_home_directory() to test_site.

(cherry picked from commit f2f4555d82)
2018-12-05 21:56:24 +01:00
Serhiy Storchaka 93d7918f77
[2.7] bpo-16865: Support arrays >=2GB in ctypes. (GH-3006). (GH-7441)
(cherry picked from commit 735abadd5b)

Co-Authored-By: Segev Finer <segev208@gmail.com>
2018-12-04 12:38:07 +02:00
Victor Stinner c275be5441
bpo-35368: Make PyMem_Malloc() thread-safe in debug mode (GH-10828)
When Python is compiled in debug mode, PyMem_Malloc() uses debug
hooks, but it also uses pymalloc allocator instead of malloc().
Problem: pymalloc is not thread-safe, whereas PyMem_Malloc() is
thread-safe in release mode (it's a thin wrapper to malloc() in this
case).

Modify the debug hook to use malloc() for PyMem_Malloc().
2018-12-03 12:29:29 +01:00
Victor Stinner 8f83c2fb19
bpo-33015: Fix UB in pthread PyThread_start_new_thread (GH-6008) (GH-10823)
Fix an undefined behaviour in the pthread implementation of
PyThread_start_new_thread(): add a function wrapper to always return
NULL.

Add pythread_callback struct and pythread_wrapper() to thread_pthread.h.

(cherry picked from commit 9eea6eaf23)
2018-11-30 17:04:35 +01:00
Victor Stinner 36003003f2
bpo-34279, regrtest: Issue a warning if no tests have been executed (GH-10801)
Co-Authored-By: Pablo Galindo <Pablogsal@gmail.com>
2018-11-29 21:14:42 +01:00
Julien Palard daa34b84e9 [2.7] bpo-35035: Rename email.utils documentation to email.utils.rst (GH-10023) (GH-10667)
https://bugs.python.org/issue35035
2018-11-22 14:18:05 -08:00
Miss Islington (bot) 4845aa6ef8 Upgrade pip to 18.1 and setuptools to 40.6.2 (GH-10598)
(cherry picked from commit 8b9c33ea9c)

Co-authored-by: Donald Stufft <donald@stufft.io>
2018-11-19 08:07:58 -05:00
Gregory P. Smith b6f4472dc4
[2.7] bpo-35214: Fix OOB memory access in unicode escape parser (GH-10506) (GH-10538)
Discovered using clang's MemorySanitizer.

A msan build will fail by simply executing: ./python -c 'u"\N"'
(cherry picked from commit 746b2d3)

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google LLC]
2018-11-14 11:55:07 -08:00
Benjamin Peterson a614cc9208
[2.7] closes bpo-35139: The `pyexpat` module's macros in `Modules/Setup` now match `setup.py` (GH-10293)
This could cause compile errors on macOS or other platforms..
(cherry picked from commit 318ab63c01)

Co-authored-by: Max Bélanger <aeromax@gmail.com>
2018-11-01 20:28:34 -07:00
Miss Islington (bot) 05acd44ad6
bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217)
_io.IncrementalNewlineDecoder's initializer possibly assigns out-of-range
value to the bitwise struct field.
(cherry picked from commit b08746bfdf)

Co-authored-by: Xiang Zhang <angwerzx@126.com>
2018-10-31 05:37:06 -07:00
matthewbelisle-wf bc6f74a520 bpo-34866: Add max_num_fields to cgi.FieldStorage (GH-9660) (GH-9969)
Adding `max_num_fields` to `cgi.FieldStorage` to make DOS attacks harder by
limiting the number of `MiniFieldStorage` objects created by `FieldStorage`.

(cherry picked from commit 209144831b)
2018-10-30 22:16:26 +01:00
Serhiy Storchaka aaea2802da
[2.7] bpo-34794: Fix a leak in Tkinter. (GH-10025) (GH-10181)
Based on the investigation by Xiang Zhang.
(cherry picked from commit df13df41a2)
2018-10-28 19:36:02 +02:00
Miss Islington (bot) e389de8e3e
bpo-35079: Revise difflib.SequenceManager.get_matching_blocks doc (GH-10144)
Specify that blocks are non-overlapping. Change '!=' to '<'.
(cherry picked from commit d9bff4e81b)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2018-10-26 20:09:10 -07:00
Denis Ledoux 6f97a50c86 bpo-35017, socketserver: don't accept request after shutdown (GH-9952) (GH-10129)
Prior to this revision, after the shutdown of a `BaseServer`,
the server accepted a last single request
if it was sent between the server socket polling
and the polling timeout.

This can be problematic for instance for a server restart
for which you do not want to interrupt the service,
by not closing the listening socket during the restart.
One request failed because of this behavior.

Note that only one request failed,
following requests were not accepted, as expected.

(cherry picked from commit 10cb3760e8)
2018-10-26 17:15:22 +02:00
Tal Einat a1f45ec73f bpo-33899: Revert tokenize module adding an implicit final NEWLINE (GH-10072)
This reverts commit 7829bba.
2018-10-24 10:32:21 -07:00
Serhiy Storchaka 427b8c7f7d
[2.7] bpo-34936: Fix TclError in tkinter.Spinbox.selection_element(). (GH-9760) (GH-9957) (GH-9968)
(cherry picked from commit 1deea5e539).
(cherry picked from commit bd9c2ce7ac)

Co-authored-by: Juliette Monsel <j4321@users.noreply.github.com>
2018-10-21 10:10:24 +03:00
Cheryl Sabella 18c44cc0c1 [2.7] bpo-31500: IDLE: Scale default fonts on HiDPI displays. (GH-3639) (GH-6585)
(cherry picked from commit a96c96f5da)
2018-10-20 16:27:51 -04:00
Miss Islington (bot) 2546ac8eeb bpo-34791: xml package obeys ignore env flags (GH-9544) (GH-9547)
The xml.sax and xml.dom.domreg modules now obey
sys.flags.ignore_environment.

Signed-off-by: Christian Heimes <christian@python.org>

https://bugs.python.org/issue34791
(cherry picked from commit 223e501fb9)

Co-authored-by: Christian Heimes <christian@python.org>
2018-10-20 01:09:35 +02:00
Stéphane Wirtel 6e57382464 [2.7] bpo-23420: Verify the value of '-s' when execute the CLI of cProfile (GH-9925) (GH-9928)
Verify the value for the parameter '-s' of the cProfile CLI. Patch by Robert
Kuska.

Co-authored-by: Robert Kuska <rkuska@gmail.com>
(cherry picked from commit fcd5e84a51)





https://bugs.python.org/issue23420
2018-10-17 04:51:28 -07:00
Miss Islington (bot) f82c9f1e1a
bpo-34967: Sphinx is deprecating add_description_unit, use add_object_type (GH-9827)
(cherry picked from commit e385d0661e)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
2018-10-15 23:47:26 -07:00
Zackery Spytz f5e00f490a [2.7] bpo-16965: 2to3 now rewrites execfile() to open with rb. (GH-8569) (GH-9890)
(cherry picked from commit d4d60134b2)
2018-10-16 08:46:35 +03:00
Victor Stinner aadb44ee98
bpo-34989: python-gdb.py: fix current_line_num() (GH-9889) (GH-9899)
python-gdb.py now handles errors on computing the line number
of a Python frame.

Changes:

* PyFrameObjectPtr.current_line_num() now catchs any Exception on
  calling addr2line(), instead of failing with a surprising "<class
  'TypeError'> 'FakeRepr' object is not subscriptable" error.
* All callers of current_line_num() now handle current_line_num()
  returning None.
* PyFrameObjectPtr.current_line() now also catchs IndexError on
  getting a line from the Python source file.

(cherry picked from commit 2e438cc255)
2018-10-16 00:06:23 +02:00
Serhiy Storchaka 43308dfc33
[2.7] bpo-34974: Do not replace unexpected errors in bytearray(). (GH-9852) (GH-9885)
The bytearray constructor converted unexpected exceptions
(e.g. MemoryError and KeyboardInterrupt) to TypeError.
(cherry picked from commit e890421e33)
2018-10-15 08:46:16 +03:00
Zackery Spytz 68ddb59417 [2.7] bpo-22851: Fix a segfault when accessing generator.gi_frame.f_restricted. (GH-9348)
Frame's field f_tstate is NULL when the generator is exhausted.
2018-10-13 12:25:05 +03:00
Victor Stinner b274f1ce5c
bpo-32962: Fix test_gdb failure in debug build with -mcet -fcf-protection -O0 (GH-9656) (GH-9788)
When Python is built with the intel control-flow protection flags,
-mcet -fcf-protection, gdb is not able to read the stack without
actually jumping inside the function. This means an extra
'next' command is required to make the $pc (program counter)
enter the function and make the stack of the function exposed to gdb.

test_gdb: get_gdb_repr() now uses the "backtrace 1" command after
breakpoint, as in the master branch.

Co-Authored-By: Marcel Plch <gmarcel.plch@gmail.com>

(cherry picked from commit 9b7c74ca32)
(cherry picked from commit 79d21331e6)
2018-10-10 12:54:04 +02:00
tzickel 4a7dd30f58 [2.7] bpo-34172: multiprocessing.Pool leaks resources after being deleted (GH-9686)
Fix a reference issue inside multiprocessing.Pool that caused the pool to remain alive if it was deleted without being closed or terminated explicitly.
2018-10-03 13:50:04 +02:00
Andrés Delfino 8d3b0f4902 [2.7] bpo-13407: Mention that bz2/tarfile doesn't support multi-stream bzip2 files (GH-8428)
* bpo-13407: Mention that tarfile doesn't support multistream bzip2 files

* Add mention to bz2 module also
2018-09-29 10:57:35 -06:00
Serhiy Storchaka 69d0bc1430
[2.7] bpo-34610: Fixed iterator of multiprocessing.managers.DictProxy. (GH-9113). (GH-9500)
(cherry picked from commit e0e5065dae)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-09-22 21:34:16 +03:00
Serhiy Storchaka 6ec2981148
[2.7] bpo-34472: Add data descriptor signature to zipfile (GH-8871) (ПР-9407)
This makes streamed zips compatible with MacOS Archive Utility and
other applications.
(cherry picked from commit 4ba3b50bfe)

Co-authored-by: Silas Sewell <silas@sewell.org>
2018-09-22 20:48:23 +03:00
Miss Islington (bot) 10be1d3f80
[2.7] bpo-34623: Mention CVE-2018-14647 in news entry (GH-9482) (GH-9490)
https://bugs.python.org/issue34623
(cherry picked from commit 026337a710)


Co-authored-by: Christian Heimes <christian@python.org>


https://bugs.python.org/issue34623
2018-09-21 21:57:00 -07:00
Christian Heimes 49d65958e1 [2.7] bpo-34542: Update test certs and keys (GH-8997) (GH-9397)
Update all test certs and keys to use future proof crypto settings:

* 3072 bit RSA keys
* SHA-256 signature

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit e6dac00779)



https://bugs.python.org/issue34542
2018-09-20 03:33:53 -07:00
Vladimir Matveev b63a16febb [2.7] bpo-34603, ctypes/libffi_msvc: Fix returning structs from functions (GH-9258) (GH-9425)
Co-authored-by: Vladimir Matveev <v2matveev@outlook.com>
2018-09-19 13:48:21 -07:00
Serhiy Storchaka 29034baf58
[2.7] bpo-34341: Fix appending to ZIP archives with the ZIP64 extension. (GH-8683). (GH-9400)
(cherry picked from commit 9bdb7be482)
2018-09-18 23:28:34 +03:00
Christian Heimes 18b20bad75 [2.7] bpo-34623: Use XML_SetHashSalt in _elementtree (GH-9146) (GH-9394)
The C accelerated _elementtree module now initializes hash randomization
salt from _Py_HashSecret instead of libexpat's default CPRNG.

Signed-off-by: Christian Heimes <christian@python.org>

https://bugs.python.org/issue34623.
(cherry picked from commit cb5778f00c)

Co-authored-by: Christian Heimes <christian@python.org>



https://bugs.python.org/issue34623
2018-09-18 06:13:09 -07:00
Christian Heimes 5f883fcb9b [2.7] bpo-34710: fix SSL module build (GH-9347) (GH-9353)
Include ``openssl/dh.h`` header file to fix implicit function declaration of ``DH_free()``.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>.
(cherry picked from commit b3a271fc0c)

Co-authored-by: Alexandru Ardelean <ardeleanalex@gmail.com>



https://bugs.python.org/issue34710
2018-09-17 06:42:30 -07:00
xdegaye 57e70d3802 [2.7] bpo-19417: Add test_bdb.py (GH-5217) (GH-6156)
(cherry picked from commit 3fe33043ee)



https://bugs.python.org/issue19417
2018-09-15 23:09:14 -07:00
Benjamin Peterson 18e21883a4
[2.7] closes bpo-34661: Fix test_shutil if unzip doesn't support -t. (GH-9267)
(cherry picked from commit a710ebd21b)
2018-09-13 11:24:07 -07:00
Benjamin Peterson 69e9691015
[2.7] closes bpo-34652: Always disable lchmod on Linux. (GH-9242)
(cherry picked from commit 40caa05fa4)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2018-09-12 16:31:17 -07:00
Zackery Spytz b36567bef8 [2.7] bpo-28994: Remove mistakenly backported atexitmodule.c (GH-9214)
It was backported in 0cc43df05e.
2018-09-12 14:28:18 +03:00
Steve Dower e351fe241c [2.7] bpo-34405: Updated to OpenSSL 1.0.2p for Windows builds. (GH-8776) (GH-9202)
https://bugs.python.org/issue34405
2018-09-11 18:02:40 -07:00
Miss Islington (bot) aa02ab15ae
[2.7] bpo-34405: Update to OpenSSL 1.0.2p for macOS installer builds (GH-9191) (GH-9196)
(cherry picked from commit 31912b43c9)


Co-authored-by: Ned Deily <nad@python.org>

<!-- issue-number: [bpo-34405](https://www.bugs.python.org/issue34405) -->
https://bugs.python.org/issue34405
<!-- /issue-number -->
2018-09-11 16:53:20 -07:00
Chih-Hsuan Yen d919c60e69 [2.7] bpo-32502: Discard 64-bit (and other invalid) hardware addresses (GH-9125)
(cherry picked from commit 6b273f7f40)

Co-authored-by: Bo Bayles <bbayles@gmail.com>
2018-09-11 13:54:57 -07:00
Benjamin Peterson 253279c616
[2.7] closes bpo-31608: Fix a crash in methods of a subclass of _collections.deque with a bad __new__(). (GH-9179) 2018-09-11 13:41:57 -07:00
Miss Islington (bot) 7a501def4f
bpo-34625: Update vendorized expat version to 2.2.6. (GH-9150)
(cherry picked from commit 5033aa77aa)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2018-09-10 21:26:42 -07:00
tzickel f64c813de8 bpo-25083: Python can sometimes create incorrect .pyc files (GH-8449)
Python 2 never checked for I/O error when reading .py files and
thus could mistake an I/O error for EOF and create incorrect .pyc
files.
This adds an check for this and aborts on an error.
2018-09-10 11:46:14 -07:00
Victor Stinner bf2bd8f8a1
bpo-25750: fix refcounts in type_getattro() (GH-6118) (GH-9091)
When calling tp_descr_get(self, obj, type), make sure that
we own a strong reference to "self".

(cherry picked from commit 8f735485ac)
2018-09-07 10:15:31 +02:00
Victor Stinner 7056ca880b
bpo-34530: Fix distutils find_executable() (GH-9049) (GH-9058)
distutils.spawn.find_executable() now falls back on os.defpath if the
PATH environment variable is not set.

(cherry picked from commit 39487196c8)
2018-09-04 11:40:29 +02:00
Mickaël Schoentgen 30af2e737a bpo-34500: Fix ResourceWarning in difflib.py (GH-8926)
The change to Tools/scripts/diff.py effectively backports part of
a2637729f2.
The test code changed in Doc/library/difflib.rst is not present in current 3.x.
2018-09-02 21:48:08 -04:00
Benjamin Peterson d8b103b8b3
closes bpo-34540: Convert shutil._call_external_zip to use subprocess rather than distutils.spawn. (GH-8985) 2018-08-29 21:59:21 -07:00
Tal Einat 491740f116
[2.7] bpo-6700: Fix inspect.getsourcelines for module level frames/tracebacks (GH-8864)
(cherry picked from commit 91cb298f81)

Co-authored-by: Vladimir Matveev <v2matveev@outlook.com>
2018-08-26 11:44:53 +03:00
Benjamin Peterson 67dafd5c20
[2.7] Issue GH-18560: Fix potential NULL pointer dereference in sum(). (GH-8892)
(cherry picked from commit 704e2d374f)

Co-authored-by: Christian Heimes <christian@cheimes.de>
2018-08-23 22:28:39 -07:00
Christian Heimes 2ec530cd55
[2.7] bpo-34391: Fix ftplib test for TLS 1.3 (GH-8787) (GH-8791)
Read from data socket to avoid "[SSL] shutdown while in init" exception
during shutdown of the dummy server.

Signed-off-by: Christian Heimes <christian@python.org>

<!-- issue-number: [bpo-34391](https://www.bugs.python.org/issue34391) -->
https://bugs.python.org/issue34391
<!-- /issue-number -->.
(cherry picked from commit 1590c39336)

Co-authored-by: Christian Heimes <christian@python.org>
2018-08-16 21:38:44 +02:00
Miss Islington (bot) 00aebabc71
closes bpo-34400: Fix undefined behavior in parsetok(). (GH-4439)
Avoid undefined pointer arithmetic with NULL.
(cherry picked from commit 7c4ab2afb1)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-08-15 02:59:11 -04:00
Christian Heimes 1f34aece28
[2.7] bpo-34399: 2048 bits RSA keys and DH params (GH-8762) (GH-8765)
Downstream vendors have started to deprecate weak keys. Update all RSA keys
and DH params to use at least 2048 bits.

Finite field DH param file use RFC 7919 values, generated with

    certtool --get-dh-params --sec-param=high

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 88bfd0bce0)

Co-authored-by: Christian Heimes <christian@python.org>
2018-08-14 16:53:04 +02:00
Terry Jan Reedy 24a54da945
[2.7] bpo-34275: Make IDLE calltips always visible on Mac. (GH-8639) (GH-8644)
Some MacOS-tk combinations need .update_idletasks().
The call is both unneeded and innocuous on Linux and Windows.
Patch by Kevin Walzer.

(cherry picked from commit 9beaef6225)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2018-08-02 23:40:20 -04:00
Tal Einat 894940b109
[2.7] bpo-34120: fix IDLE freezing after closing dialogs (GH-8603)
Added missing .grab_release() calls to all places where we call .grab_set().

(cherry picked from commit 10ea9409ce)
2018-08-02 10:21:49 +03:00
Xtreak 2bea771609 bpo-34229: Check start and stop of slice object to be long when they are not int in PySlice_GetIndices (GH-8480) 2018-07-26 19:20:34 +03:00
Miss Islington (bot) 7868426c1f
bpo-33336, imaplib: Legalize MOVE command (GH-6569)
imaplib now allows MOVE command in IMAP4.uid() (RFC 6851:
IMAP MOVE Extension) and potentially as a name of supported
method of IMAP4 object.
(cherry picked from commit caa331d492)

Co-authored-by: Matěj Cepl <mcepl@cepl.eu>
2018-07-23 07:07:03 -07:00
Zackery Spytz 3252205077 bpo-25943: Fix potential heap corruption in bsddb's _db_associateCallback() (GH-8337)
There was a missing check for integer overflow, several function calls
were not checked for failure, and allocated memory was not freed if an
error occurred.
2018-07-21 11:27:44 +03:00
Serhiy Storchaka fc153d1279
[2.7] bpo-34068: iobase_close could call PyObject_SetAttrString with an exception set (GH-8282). (GH-8312) (GH-8314)
(cherry picked from commit 28f07364f0)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>.
(cherry picked from commit cc13016658)
2018-07-17 18:15:46 +03:00
Miss Islington (bot) a45fa39d85
bpo-34080: Fix a memory leak in the compiler. (GH-8222)
(cherry picked from commit 993030aac5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-07-11 14:53:17 -07:00
Serhiy Storchaka ef19fd200d
[2.7] bpo-23927: Make getargs.c skipitem() skipping 'w*'. (GH-8192). (GH-8255)
(cherry picked from commit 504373c59b)

Also backport tests for skipitem() and handling errors.
2018-07-11 19:49:17 +03:00
Serhiy Storchaka b1e6e5615a
bpo-26544: Fixed implementation of platform.libc_ver(). (GH-7684). (GH-8193) (GH-8196)
(cherry picked from commit 2a9b8babf0).
(cherry picked from commit 7c43b80150)
2018-07-09 14:39:06 +03:00
Benjamin Peterson 3707dfaf45
[2.7] closes bpo-34050: Fix link in SSL docs (GH-8173). (GH-8179)
(cherry picked from commit 9c5ba09748)

Co-authored-by: Marcin Niemira <marcin@niemira.net>
2018-07-07 15:48:07 -07:00
Pablo Galindo 8902a1d14e
[2.7] bpo-34019: Fix wrong arguments for Opera Browser (GH-8047) (#8126)
The Opera Browser was using a outdated command line invocation that resulted in an incorrect URL being opened in the browser when requested using the webbrowser module.

* Correct the arguments passed to the Opera Browser when opening a new URL..
(cherry picked from commit 3cf1f154ed)

Co-authored-by: Bumsik Kim <k.bumsik@gmail.com>
2018-07-07 00:54:09 +01:00
Ammar Askar 7829bba45d [2.7] bpo-33899: Make tokenize module mirror end-of-file is end-of-line behavior (GH-7891) (#8133)
Most of the change involves fixing up the test suite, which previously made
the assumption that there wouldn't be a new line if the input didn't end in
one.

Contributed by Ammar Askar.

(cherry picked from commit c4ef4896ea)
2018-07-06 13:23:13 +03:00
Serhiy Storchaka 9b84cc8771
[2.7] bpo-33974: Fix passing special characters to ttk widgets. (GH-7986) (GH-8021)
Fix passing lists and tuples of strings containing special characters
'"', '\\', '{', '}' and '\n' as options to tkinter.ttk widgets.
(cherry picked from commit 5bb5bbfca8)
2018-06-30 13:34:56 +03:00
Zackery Spytz 0464de0f9a [2.7] bpo-25862: Fix assertion failures in io.TextIOWrapper.tell(). (GH-3918). (GH-8013)
(cherry picked from commit 23db935bcf)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-06-29 23:07:13 +03:00
Benjamin Peterson 468f97b464
[2.7] closes bpo-33956: update vendored expat to 2.2.5 (GH-7925)
(cherry picked from commit 4e21100fa7)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2018-06-26 20:56:58 -07:00
Victor Stinner 5430c14aba
[2.7] bpo-33873: Backport regrtest from master (GH-7936)
* bpo-33718: regrtest: use format_duration() to display failed tests (GH-7686)

* Enhance also format_duration(): work on integers and rounds towards
  +infinity (math.ceil).
* Write unit tests on format_duration()

(cherry picked from commit 4ffe9c2b25)

* bpo-33873: regrtest: Add warning on -R 1:3 (GH-7736)

regrtest: Add warning when using less than 3 warmup runs like -R 1:3.

(cherry picked from commit cac4fef886)

* bpo-33873: Fix bug in `runtest.py` and add checks for invalid `-R` parameters (GH-7735)

Fix bug in `Lib/test/libregrtest/runtest.py` that makes running tests an extra time than the specified number of runs.

Add check for invalid --huntrleaks/-R parameters.

(cherry picked from commit 58ed7307ea)
2018-06-26 23:57:12 +02:00
native-api b18f098357 bpo-33711: Fix license generation error in installer build script (GH-7241) 2018-06-24 17:50:23 -05:00
Victor Stinner 319cfb5f30
bpo-30345: Add -g to LDFLAGS for LTO (GH-7709) (GH-7825)
Add -g to LDFLAGS when compiling with LTO to get debug symbols.
2018-06-22 09:11:33 +02:00
Victor Stinner f2918881b7
bpo-33901: Fix test_gdbm for gdbm 1.15 (GH-7798) (GH-7818)
Fix test_gdbm.test_reorganize() on macOS with gdbm 1.15: add a
larger value to make sure that the file size changes.

(cherry picked from commit 13c79c677f)
2018-06-20 10:57:38 +02:00
Terry Jan Reedy c488558faa
[2.7] bpo-33856: Add "help" to the welcome message of IDLE (GH-7755) (GH-7758)
Make it the same as when one runs 'python'..
(cherry picked from commit 9d49f85064)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
2018-06-16 18:15:18 -04:00
Victor Stinner e36f94f204
bpo-32962: Backport python-gdb.py and test_gdb.py from master (GH-7726)
* bpo-32962: python-gdb catchs ValueError on read_var() (GH-7692)

python-gdb now catchs ValueError on read_var(): when Python has no
debug symbols for example.

(cherry picked from commit 019d33b7a4)

* bpo-32962: python-gdb catchs UnicodeDecodeError (GH-7693)

python-gdb now catchs UnicodeDecodeError exceptions when calling
string().

(cherry picked from commit d22fc0bc7d)

bpo-29367: python-gdb.py now supports also method-wrapper
(wrapperobject) objects.

(cherry picked from commit 611083331d)
2018-06-15 23:59:56 +02:00
Xiang Zhang 1889c4cbd6
bpo-29456: Fix bugs in unicodedata.normalize: u1176, u11a7 and u11c3 (GH-1958) (GH-7704)
Hangul composition check boundaries are wrong for the second character
([0x1161, 0x1176) instead of [0x1161, 0x1176]) and third character ((0x11A7, 0x11C3)
instead of [0x11A7, 0x11C3])..
(cherry picked from commit d134809cd3)

Co-authored-by: Wonsup Yoon <pusnow@me.com>
2018-06-15 21:26:55 +08:00
Miss Islington (bot) 4e6bd247aa
bpo-11874: fix assertion failure in argparse metavar handling (GH-1826)
- bugfix and test for fragile metavar handling in argparse (see
  bpo-24089, bpo-14046, bpo-25058, bpo-11874)
- also fixes some incorrect tests that did not make 1-element tuples correctly
(cherry picked from commit 66f02aa32f)

Co-authored-by: wim glenn <wim.glenn@gmail.com>
2018-06-08 18:28:02 -07:00
Serhiy Storchaka 3014d6eb7f
[2.7] bpo-33767: Fix improper use of SystemError by mmap.mmap objects (GH-7381) (GH-7432)
Raise TypeError instead of SystemError for unsupported operations.
(cherry picked from commit e9e3976057)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-06-05 19:51:37 +03:00
Antoine Pitrou ded666ff0c
[2.7] bpo-30654: Do not reset SIGINT handler to SIG_DFL in finisignal (GH-7146) (GH-7347)
(cherry picked from commit e905c84494)
2018-06-03 20:46:43 +02:00
Serhiy Storchaka d5e7556e52
bpo-33645: Fix an "unknown parsing error" in the parser. (GH-7119)
It is reproduced when parse the "<>" operator and run
Python with both options -3 and -We.
2018-05-31 07:35:39 +03:00
Victor Stinner 823c295efa
bpo-29512: Rename Lib/test/bisect.py to bisect_cmd.py (#7229)
Rename Lib/test/bisect.py to Lib/test/bisect_cmd.py. The old name was
in conflict with Lib/bisect.py, causing test failures, depending how
tests were run.

For example, "python2.7 Lib/test/test_httpservers.py" imported
indirectly Lib/test/bisect.py instead of Lib/bisect.py
on "import bisect".
2018-05-30 17:24:40 +02:00
Pablo Galindo 19f6bd06af bpo-33354: Fix test_ssl when a filename cannot be encoded (GH-6613)
Skip test_load_dh_params() of test_ssl when Python filesystem encoding
cannot encode the provided path.
2018-05-25 00:20:44 +02:00
Serhiy Storchaka 9044cd6759
[2.7] bpo-33622: Fix issues with handling errors in the GC. (GH-7078) (#7096)
* Fixed a leak when the GC fails to add an object with __del__ into
  the gc.garbage list.
* PyGC_Collect() can now be called when an exception is set and
  preserves it.
(cherry picked from commit 301e3cc8a5)
2018-05-24 23:27:08 +03:00
Serhiy Storchaka 6c58f7f4b1
[2.7] Fix line breaks added after hyphens by blurb. (GH-7052) 2018-05-22 14:55:52 +03:00
Serhiy Storchaka ea9a0994cd
[2.7] bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922) (GH-7015)
uuid._ipconfig_getnode did not validate the maximum length of the value,
so long as the value had the same type of formatting as a MAC address.
This let it select DUIDs as MAC addresses. It now requires an exact
length match..
(cherry picked from commit c66c342cb4)

Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
2018-05-21 01:50:33 +03:00
Stéphane Wirtel ad65d09fd0 [2.7] bpo-33503: Fix the broken pypi link in the source and the documentation (GH-6814). (GH-6905)
(cherry picked from commit 19177fbd5d)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
2018-05-16 10:57:36 -04:00
Serhiy Storchaka 861d38443d
[2.7] bpo-32861: robotparser fix incomplete __str__ methods. (GH-5711) (GH-6795) (GH-6817)
The robotparser's __str__ representation now includes wildcard
entries.
(cherry picked from commit c3fa1f2b93)

Co-authored-by: Michael Lazar <lazar.michael22@gmail.com>.
2018-05-15 01:09:47 +03:00
Bo Bayles afe5f633e4 bpo-33038: Fix gzip.GzipFile for file objects with a non-string name attribute. (GH-6095) 2018-05-09 13:14:40 +03:00
Serhiy Storchaka 903f189b6e
bpo-33096: Removed unintentionally backported from Python 3 Tkinter files. (GH-6724)
This partially reverts commit e80a232f2c.
2018-05-08 10:09:08 +03:00
Andrés Delfino c40eeeb5e6 [2.7] bpo-33422: Fix quotation marks getting deleted when looking up byte/string literals on pydoc. (GH-6701) (GH-6712)
Also update the list of string prefixes.
(cherry picked from commit b2043bbe60)
2018-05-07 08:44:03 +03:00
Serhiy Storchaka a55ac801f7
[2.7] bpo-20087: Update locale alias mapping with glibc 2.27 supported locales. (GH-6708). (GH-6717)
(cherry picked from commit cedc9b7420)
2018-05-06 10:51:49 +03:00
Cheryl Sabella 3a04598f63 bpo-32857: Raise error when tkinter after_cancel() is called with None. (GH-5701) (GH-6620)
(cherry picked from commit 74382a3f17)
2018-05-05 16:10:48 +03:00
Miss Islington (bot) 6d3d02c69a
bpo-33391: Fix refleak in set_symmetric_difference (GH-6670)
(cherry picked from commit 491bbedc20)

Co-authored-by: lekma <lekmalek@gmail.com>
2018-05-02 03:23:41 -07:00
Serhiy Storchaka 07ad02f62c
[2.7] bpo-33256: Replace angle brackets around python object repr to display it in html (GH-6442). (GH-6650)
(cherry picked from commit 7d68bfa826)

Co-authored-by: sblondon <sblondon@users.noreply.github.com>
2018-04-30 11:34:47 +03:00
Benjamin Peterson 75c8df51ac merge 2.7.15 release branch 2018-04-29 15:48:13 -07:00
Benjamin Peterson 4c86fc01f6 generate 2.7.15 NEWS 2018-04-29 15:47:18 -07:00
Benjamin Peterson 0b3800d82a Merge 2.7.15 release branch 2018-04-29 12:24:24 -07:00
Florian Weimer 0b91f8a668 Indicate that _PyGC_Head is only 8-byte aligned. (closes bpo-33374)
By spec, the "long double" in _PyGC_Head requires the union to always be 16-byte
aligned. However, obmalloc only yields 8-byte alignment. Compilers including GCC
8 are starting to use alignment information to do store-merging. So, the "long
double" needs to be changed to a simple "double" as was long ago done in Python
3 by e348c8d154. For 2.7, we need to add some
dummy padding to make sure _PyGC_Head stays the same size.
2018-04-29 12:18:33 -07:00
Benjamin Peterson 3219bbf6a1
fix running the curses.has_key module (closes bpo-33359) (GH-6608)
This was broken by poor automated translation back in 6e3dbbdf39.
2018-04-25 22:57:34 -07:00
Miss Islington (bot) 4caba7a940
bpo-33131: Upgrade ensurepip to bundle pip 10.0.1 (GH-6546)
Upgrade ensurepip to bundle pip 10.0.1
(cherry picked from commit 0399cf9b5e)

Co-authored-by: Paul Moore <p.f.moore@gmail.com>
2018-04-20 13:48:43 -07:00
Serhiy Storchaka d988c0b6bd
[2.7] bpo-33308: Fix a crash in the parser module when convert an ST object. (GH-6519) (GH-6532)
Converting with line_info=False and col_info=True crashed before.
(cherry picked from commit e5362eaa75)
2018-04-19 09:16:43 +03:00
Benjamin Peterson f2f1d4b2a5 make NEWS for 2.7.15rc1 2018-04-14 15:06:13 -07:00
Steve Dower bba2ba180d bpo-33148: Update Windows build to use OpenSSL 1.0.2o
closes https://github.com/python/cpython/pull/6474
2018-04-14 15:04:21 -07:00
Miss Islington (bot) 01a0fd4a3a [2.7] bpo-33184: Update macOS installer build to use OpenSSL 1.0.2o. (GH-6408) (GH-6471)
(cherry picked from commit 76215a4481)

Co-authored-by: Ned Deily <nad@python.org>
2018-04-14 11:21:02 -04:00
Ned Deily 93c91ac8f6
[2.7] Fix errant NEWS item: bpo-19019 -> bpo-17128 (GH-6470) 2018-04-14 10:56:17 -04:00
Ned Deily ee8e4b61d6
[2.7] Backport macOS universal build and installer fixes from 3.6. (GH-6469)
These include:

- bpo-32726: Provide an additional, more modern macOS installer variant that
  supports macOS 10.9+ systems in 64-bit mode only. Upgrade the supplied
  third-party libraries to OpenSSL 1.0.2n and SQLite 3.22.0. The 10.9+
  installer now supplies its own private copy of Tcl/Tk 8.6.8.

- bpo-24414: Default macOS deployment target is now set by ``configure`` to
  the build system's OS version (as is done by Python 3), not ``10.4``;
  override with, for example, ``./configure MACOSX_DEPLOYMENT_TARGET=10.4``.

- bpo-19019: All 2.7 macOS installer variants now supply their own version
  of ``OpenSSL 1.0.2``; the Apple-supplied SSL libraries and root
  certificates are not longer used.  The ``Installer Certificate`` command
  in ``/Applications/Python 2.7`` may be used to download and install a
  default set of root certificates from the third-party ``certifi`` package.

- bpo-11485: python.org macOS Pythons no longer supply a default SDK value
  (e.g. ``-isysroot /``) or specific compiler version default (e.g.
  ``gcc-4.2``) when building extension modules.  Use ``CC``, ``SDKROOT``,
  and ``DEVELOPER_DIR`` environment variables to override compilers or to
  use an SDK.  See Apple's ``xcrun`` man page for more info.

- prepare for pending Apple removal of 32-bit support in future macOS release
2018-04-14 10:37:28 -04:00
Serhiy Storchaka a61f5da547
[2.7] bpo-31920: Fixed handling directories as arguments in the ``pygettext`` script. (GH-6259) (GH-6436)
Based on patch by Oleg Krasnikov.
(cherry picked from commit c93938b5be)
2018-04-10 11:03:52 +03:00
Miss Islington (bot) 77f0a41d72 [2.7] bpo-8243: Doc patch for curses.window.addstr and curses.window.addch (GH-5179) (GH-6405)
(cherry picked from commit ef5ce884a4)

Co-authored-by: Jay Crotts <crotts.jay@gmail.com>
2018-04-06 22:01:35 -04:00
Cheryl Sabella 325191bd6b [2.7] bpo-27212: Modify islice recipe to consume initial values preceding start (GH-6195) (GH-6339)
(cherry picked from commit da1734c58d)
2018-04-01 22:29:01 -07:00
Serhiy Storchaka e80a232f2c
[2.7] bpo-33096: Fix ttk.Treeview.insert. (GH-6228) (GH-6326)
Allow ttk.Treeview.insert to insert iid that has a false boolean value.
Note iid=0 and iid=False would be same.
(cherry picked from commit 3ab44c0783)

Co-authored-by: Garvit Khatri <garvitdelhi@gmail.com>
2018-04-01 02:42:58 +03:00
scoder c498cd8bf8 bpo-31544: Fix a reference leak to 'self' after the previous target error handling fixes. (GH-6318)
This change generally splits the xmlparser creation code into an unsafe part with "rollback" error handling and a safe "object initialisation done" part with normal decref cleanup.
2018-03-31 15:23:30 +03:00
Miss Islington (bot) 7f48a426fc bpo-33163: Upgrade pip to 9.0.3 and setuptools to v39.0.1. (GH-6284)
(cherry picked from commit c0518cde7a)

Co-authored-by: Ned Deily <nad@python.org>
2018-03-28 04:55:30 -04:00
Christian Heimes edd541897b
[2.7] bpo-33127: Compatibility patch for LibreSSL 2.7.0 (GH-6210) (GH-6215)
LibreSSL 2.7 introduced OpenSSL 1.1.0 API. The ssl module now detects
LibreSSL 2.7 and only provides API shims for OpenSSL < 1.1.0 and
LibreSSL < 2.7.

Documentation updates and fixes for failing tests will be provided in
another patch set.

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 4ca0739c9d)

Co-authored-by: Christian Heimes <christian@python.org>
2018-03-24 19:34:15 +01:00
scoder 0694b6a651 bpo-31544: Avoid calling "PyObject_GetAttrString()" (and potentially executing user code) with a live exception set. (GH-3992) 2018-03-24 07:56:41 +02:00
xdegaye baca85fcc7 [2.7] bpo-17288: Prevent jumps from 'return' and 'exception' trace events. (GH-6111)
(cherry picked from commit e32bbaf376)
2018-03-13 23:06:14 +02:00
Miss Islington (bot) 3854f5885e [2.7] bpo-33026: Fix jumping out of "with" block by setting f_lineno. (GH-6026). (GH-6074) (GH-6076)
(cherry picked from commit 26c9f565d0)
(cherry picked from commit 04aadf23ea)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-03-11 10:55:59 +02:00
Jamie Davis 55d5bfba94 [2.7] closes bpo-32997: Fix REDOS in fpformat (GH-5984)
The regex to decode a number in fpformat is susceptible to catastrophic backtracking. This is a potential DOS vector if a server is using fpformat on untrusted number strings.

Replace it with an equivalent non-vulnerable regex. The match behavior of the new regex is slightly different. It captures the whole integer part of the number in one group, Leading zeros are stripped off later.
2018-03-05 21:59:02 -08:00
Benjamin Peterson e052d40cea
[2.7] bpo-32981: Fix catastrophic backtracking vulns (GH-5955)
* Prevent low-grade poplib REDOS (CVE-2018-1060)

The regex to test a mail server's timestamp is susceptible to
catastrophic backtracking on long evil responses from the server.

Happily, the maximum length of malicious inputs is 2K thanks
to a limit introduced in the fix for CVE-2013-1752.

A 2KB evil response from the mail server would result in small slowdowns
(milliseconds vs. microseconds) accumulated over many apop calls.
This is a potential DOS vector via accumulated slowdowns.

Replace it with a similar non-vulnerable regex.

The new regex is RFC compliant.
The old regex was non-compliant in edge cases.

* Prevent difflib REDOS (CVE-2018-1061)

The default regex for IS_LINE_JUNK is susceptible to
catastrophic backtracking.
This is a potential DOS vector.

Replace it with an equivalent non-vulnerable regex.

Also introduce unit and REDOS tests for difflib.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
Co-authored-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 0e6c8ee235)
2018-03-03 22:18:17 -08:00
Alexey Izbyshev aa40f92240 [2.7] bpo-32903: Fix a memory leak in os.chdir() on Windows (GH-5801). (#5947)
(cherry picked from commit 3e197c7a67)

Co-authored-by: Alexey Izbyshev <izbyshev@users.noreply.github.com>
2018-03-01 18:27:34 +08:00
bennorth c20c97f612 bpo-18533: Avoid RuntimeError from repr() of recursive dictview (#4823) (#5357)
(cherry picked from commit d7773d92bd)
2018-02-27 00:35:03 +02:00
Christian Heimes 4bb9b9aea0
[2.7] bpo-32647: Link ctypes extension with libdl. (GH-5550) (#5877)
The ctypes module used to depend on indirect linking for dlopen. The shared
extension is now explicitly linked against libdl on platforms with dl.

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 5bb9692575)

Co-authored-by: Christian Heimes <christian@python.org>
2018-02-25 12:31:17 +01:00
Christian Heimes 3d87f4cf9c
[2.7] bpo-30622: Improve NPN support detection (GH-5859) (#5863)
The ssl module now detects missing NPN support in LibreSSL.

Co-Authored-By: Bernard Spil <brnrd@FreeBSD.org>
Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 6cdb7954b0)

Co-authored-by: Christian Heimes <christian@python.org>
2018-02-25 10:21:03 +01:00
Miss Islington (bot) a5c9112300 [2.7] bpo-32185: Don't send IP in SNI TLS extension (GH-5865) (#5871)
The SSL module no longer sends IP addresses in SNI TLS extension on
platforms with OpenSSL 1.0.2+ or inet_pton.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit e9370a4738)

Co-authored-by: Christian Heimes <christian@python.org>
2018-02-25 10:16:37 +01:00
Christian Heimes 6e8f395001
bpo-25404: SSLContext.load_dh_params() non-ASCII path (GH-3459)
SSLContext.load_dh_params() now supports non-ASCII path.

Signed-off-by: Christian Heimes <christian@python.org>
2018-02-25 09:48:02 +01:00
Christian Heimes 8d4d17399f
bpo-31518: Change TLS protocol for Debian (#3661)
Debian Unstable has disabled TLS 1.0 and 1.1 for SSLv23_METHOD(). Change
TLS/SSL protocol of some tests to PROTOCOL_TLS or PROTOCOL_TLSv1_2 to
make them pass on Debian.

Signed-off-by: Christian Heimes <christian@python.org>
2018-02-25 00:45:53 +01:00
Anselm Kruis 61bd4d2e63 [2.7] bpo-30028: make test.support.temp_cwd() fork-safe (GH-1066) (GH-5825)
Make test.support.temp_cwd() fork-safe. The context manager test.support.temp_cwd() no longer removes the temporary directory when executing in a process other than the parent it entered from.
If a forked child exits the context manager it won't do the cleanup..
(cherry picked from commit 33dddac00b)

Co-authored-by: Anselm Kruis <a.kruis@science-computing.de>
2018-02-23 08:27:28 -08:00
Miss Islington (bot) b852d8c1f0 [2.7] bpo-31848: Fix broken error handling in Aifc_read.initfp() when the SSND chunk is not found (GH-5240) (GH-5781)
Initialize self._ssnd_chunk so that aifc.Error is raised as intended,
not AttributeError.
(cherry picked from commit 80d20b918b)


Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-02-21 08:37:18 +02:00