[issue24620] Segfault with nonsensical random state

2015-07-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24620
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24620] Segfault with nonsensical random state

2015-07-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0933c00c2765 by Serhiy Storchaka in branch '3.4':
Issue #24620: Random.setstate() now validates the value of state last element.
https://hg.python.org/cpython/rev/0933c00c2765

New changeset 84070c1225c5 by Serhiy Storchaka in branch '2.7':
Issue #24620: Random.setstate() now validates the value of state last element.
https://hg.python.org/cpython/rev/84070c1225c5

New changeset d8229c26dd92 by Serhiy Storchaka in branch '3.5':
Issue #24620: Random.setstate() now validates the value of state last element.
https://hg.python.org/cpython/rev/d8229c26dd92

New changeset f6e399ae670f by Serhiy Storchaka in branch 'default':
Issue #24620: Random.setstate() now validates the value of state last element.
https://hg.python.org/cpython/rev/f6e399ae670f

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24620
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24620] Segfault with nonsensical random state

2015-07-23 Thread Raymond Hettinger

Raymond Hettinger added the comment:

This is ready to apply.

--
assignee: rhettinger - serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24620
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24620] Segfault with nonsensical random state

2015-07-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Can't reproduce on 32-bit.

--
components: +Extension Modules
nosy: +serhiy.storchaka
stage:  - needs patch
type:  - crash

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24620
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24620] Segfault with nonsensical random state

2015-07-12 Thread Stefan Krah

New submission from Stefan Krah:

While trying to find a possible cause for #24546, I came across this
glitch:

Python 3.6.0a0 (default:02b81a82a57d, Jul 12 2015, 20:33:44) 
[GCC 4.8.4] on linux
Type help, copyright, credits or license for more information.
 import random
 s = (3, (999,)*625, None)
 random.setstate(s)
 random.choice([1,2,3,4,5])
Segmentation fault (core dumped)

--
messages: 246661
nosy: mark.dickinson, rhettinger, skrah
priority: normal
severity: normal
status: open
title: Segfault with nonsensical random state

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24620
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24620] Segfault with nonsensical random state

2015-07-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

But I can reproduce the crash with other example.

import random
random.setstate((3, (1,)*624+(-10**9,), None))
random.random()

The index attribute can be set to negative value and this causes reading out of 
the buffer.

Here is a patch that fixes this.

--
keywords: +patch
stage: needs patch - patch review
versions: +Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file39917/random_setstate_index.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24620
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24620] Segfault with nonsensical random state

2015-07-12 Thread Stefan Krah

Stefan Krah added the comment:

I think it's just a matter of checking for self-index = N in setstate().

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24620
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24620] Segfault with nonsensical random state

2015-07-12 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee:  - rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24620
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com