Skip to content

Commit 94c3452

Browse files
committed
Fix bug reported by [email protected]; re.compile(r"[\100-\410]")
dumps core. Solution: fix check_escape() to match its comment and use only the low 8 bits of the octal number.
1 parent 137507e commit 94c3452

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/pypcre.c

Lines changed: 1 addition & 1 deletion
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ else
1064
c -= '0';
1064
c -= '0';
1065
while(i++ < 2 && (pcre_ctypes[ptr[1]] & ctype_digit) != 0 &&
1065
while(i++ < 2 && (pcre_ctypes[ptr[1]] & ctype_digit) != 0 &&
1066
ptr[1] != '8' && ptr[1] != '9')
1066
ptr[1] != '8' && ptr[1] != '9')
1067-
c = c * 8 + *(++ptr) - '0';
1067+
c = (c * 8 + *(++ptr) - '0') & 255;
1068
break;
1068
break;
1069

1069

1070
/* Special escapes not starting with a digit are straightforward */
1070
/* Special escapes not starting with a digit are straightforward */

0 commit comments

Comments
 (0)