StanFromIreland · GitHub

Bug report

Bug description:

Found (accidentally) by our OSS Fuzz fuzzer in #493449985.

The encodings.search_function() caches every codec lookup miss in an unbounded _cache dict, causing memory growth (the fuzzer gathered a 2561Mb cache causing the abort).
I would suggest we bound its size like we do elsewhere (e.g. the struct cache).

Technically, there is the possibility of a DoS vulnerability, however the PSRT decided that it is unrealistic for this to be exploited.

CPython versions tested on:

CPython main branch, 3.15, 3.14, 3.13

Operating systems tested on:

No response

Linked PRs

Read the original on github.com ↗