Skip to content

Commit 87f42aa

Browse files
khwilliamsonsteve-m-hay
authored andcommitted
CVE-2024-56406: Heap-buffer-overflow with tr//
This was due to underallocating needed space. If the translation forces something to become UTF-8 that is initially bytes, that UTF-8 could now require two bytes where previously a single one would do. (cherry picked from commit f93109c8a6950aafbd7488d98e112552033a3686)
1 parent aec44b5 commit 87f42aa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

op.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6881,6 +6881,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
68816881
* same time. But otherwise one crosses before the other */
68826882
if (t_cp < 256 && r_cp_end > 255 && r_cp != t_cp) {
68836883
can_force_utf8 = TRUE;
6884+
max_expansion = MAX(2, max_expansion);
68846885
}
68856886
}
68866887

0 commit comments

Comments
 (0)