java-topology/defects/peewee/patch/peewee-0001-sorted-field-list-bisect-index.patch

13 lines
444 B
Diff

# UNDF: UNDF-2026-000000209
diff --git a/peewee.py b/peewee.py
--- a/peewee.py
+++ b/peewee.py
@@ -6126,7 +6126,10 @@ class _SortedFieldList(object):
def index(self, field):
- return self._keys.index(field._sort_key)
+ # CWE-407 fix: use bisect to find the sort-key position in O(log n)
+ # instead of list.index() which is O(n).
+ k = field._sort_key
+ i = bisect_left(self._keys, k)
+ return i