# HG changeset patch # User Paul Boddie # Date 1479577107 -3600 # Node ID 6f1e5a97277c4d5eb8fd1d31222a1e412b243a08 # Parent 828aa694a1a12397bbfe997604c2475b5b531aa6 Prevent out-of-bounds access to lists. diff -r 828aa694a1a1 -r 6f1e5a97277c lib/__builtins__/list.py --- a/lib/__builtins__/list.py Sat Nov 19 18:30:54 2016 +0100 +++ b/lib/__builtins__/list.py Sat Nov 19 18:38:27 2016 +0100 @@ -96,7 +96,10 @@ def __get_single_item__(self, index): - "Return the item at 'index'." + "Return the item at the normalised (positive) 'index'." + + if index >= len(self): + raise IndexError(index) return native._list_element(self, index)