Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1commit 385e8759c3ff1e7f7f996bd4ea391074d61d48c1 2Author: Karl Williamson <khw@cpan.org> 3AuthorDate: 2024-12-18 18:25:29 -0700 4Commit: Steve Hay <steve.m.hay@googlemail.com> 5CommitDate: 2025-03-30 11:59:51 +0100 6 7 CVE-2024-56406: Heap-buffer-overflow with tr// 8 9 This was due to underallocating needed space. If the translation forces 10 something to become UTF-8 that is initially bytes, that UTF-8 could 11 now require two bytes where previously a single one would do. 12 13 (cherry picked from commit f93109c8a6950aafbd7488d98e112552033a3686) 14 15diff --git a/op.c b/op.c 16index 3fc23eca49a..aeee88e0335 100644 17--- a/op.c 18+++ b/op.c 19@@ -6649,6 +6649,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl) 20 * same time. But otherwise one crosses before the other */ 21 if (t_cp < 256 && r_cp_end > 255 && r_cp != t_cp) { 22 can_force_utf8 = TRUE; 23+ max_expansion = MAX(2, max_expansion); 24 } 25 } 26