Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2806)

Delta Between Two Patch Sets: Objects/object.c

Issue 13703: Hash collision security issue
Left Patch Set: Created 1 year, 5 months ago
Right Patch Set: Created 1 year, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « Objects/bytesobject.c ('k') | Objects/unicodeobject.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 1
2 /* Generic object operations; and implementation of None (NoObject) */ 2 /* Generic object operations; and implementation of None (NoObject) */
3 3
4 #include "Python.h" 4 #include "Python.h"
5 #include "sliceobject.h" /* For PyEllipsis_Type */ 5 #include "sliceobject.h" /* For PyEllipsis_Type */
6 #include "frameobject.h" 6 #include "frameobject.h"
7 7
8 #ifdef __cplusplus 8 #ifdef __cplusplus
9 extern "C" { 9 extern "C" {
10 #endif 10 #endif
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 } 705 }
706 706
707 long 707 long
708 PyObject_HashNotImplemented(PyObject *v) 708 PyObject_HashNotImplemented(PyObject *v)
709 { 709 {
710 PyErr_Format(PyExc_TypeError, "unhashable type: '%.200s'", 710 PyErr_Format(PyExc_TypeError, "unhashable type: '%.200s'",
711 Py_TYPE(v)->tp_name); 711 Py_TYPE(v)->tp_name);
712 return -1; 712 return -1;
713 } 713 }
714 714
715 _Py_HashSecret_t _Py_HashSecret;
716
715 long 717 long
716 PyObject_Hash(PyObject *v) 718 PyObject_Hash(PyObject *v)
717 { 719 {
718 PyTypeObject *tp = Py_TYPE(v); 720 PyTypeObject *tp = Py_TYPE(v);
719 if (tp->tp_hash != NULL) 721 if (tp->tp_hash != NULL)
720 return (*tp->tp_hash)(v); 722 return (*tp->tp_hash)(v);
721 /* To keep to the general practice that inheriting 723 /* To keep to the general practice that inheriting
722 * solely from object in C code should work without 724 * solely from object in C code should work without
723 * an explicit call to PyType_Ready, we implicitly call 725 * an explicit call to PyType_Ready, we implicitly call
724 * PyType_Ready here and then check the tp_hash slot again 726 * PyType_Ready here and then check the tp_hash slot again
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 assert(op->ob_refcnt == 0); 1885 assert(op->ob_refcnt == 0);
1884 ++_PyTrash_delete_nesting; 1886 ++_PyTrash_delete_nesting;
1885 (*dealloc)(op); 1887 (*dealloc)(op);
1886 --_PyTrash_delete_nesting; 1888 --_PyTrash_delete_nesting;
1887 } 1889 }
1888 } 1890 }
1889 1891
1890 #ifdef __cplusplus 1892 #ifdef __cplusplus
1891 } 1893 }
1892 #endif 1894 #endif
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7