Skip to content

Commit 51c9ef5

Browse files
committed
gh-17645: avoid oob read on conflict marker detection
Introduced in 0ae5281.
1 parent e0ab3ef commit 51c9ef5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

t/lib/croak/toke

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ EXPECT
565565
OPTIONS regex
566566
Use of code point 0x80000000(00000000)? is not allowed; the permissible max is 0x7FFFFFFF(FFFFFFFF)? at - line \d+.
567567
########
568-
# TODO gh-17645: conflict marker detection should not read out of bounds
568+
# NAME gh-17645: conflict marker detection should not read out of bounds
569569
m/$0[
570570
==0/
571571
EXPECT

toke.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8835,7 +8835,7 @@ yyl_try(pTHX_ char *s, STRLEN len)
88358835

88368836
case '=':
88378837
if (s[1] == '=' && (s == PL_linestart || s[-1] == '\n')
8838-
&& memBEGINs(s + 2, (STRLEN) (PL_bufend - s + 2), "====="))
8838+
&& memBEGINs(s + 2, (STRLEN) (PL_bufend - (s + 2)), "====="))
88398839
{
88408840
s = vcs_conflict_marker(s + 7);
88418841
goto retry;
@@ -8929,7 +8929,7 @@ yyl_try(pTHX_ char *s, STRLEN len)
89298929

89308930
case '<':
89318931
if (s[1] == '<' && (s == PL_linestart || s[-1] == '\n')
8932-
&& memBEGINs(s+2, (STRLEN) (PL_bufend - (s+2)), "<<<<<"))
8932+
&& memBEGINs(s + 2, (STRLEN) (PL_bufend - (s + 2)), "<<<<<"))
89338933
{
89348934
s = vcs_conflict_marker(s + 7);
89358935
goto retry;
@@ -8938,7 +8938,7 @@ yyl_try(pTHX_ char *s, STRLEN len)
89388938

89398939
case '>':
89408940
if (s[1] == '>' && (s == PL_linestart || s[-1] == '\n')
8941-
&& memBEGINs(s + 2, (STRLEN) (PL_bufend - s + 2), ">>>>>"))
8941+
&& memBEGINs(s + 2, (STRLEN) (PL_bufend - (s + 2)), ">>>>>"))
89428942
{
89438943
s = vcs_conflict_marker(s + 7);
89448944
goto retry;

0 commit comments

Comments
 (0)