Skip to content

Commit 034e6de

Browse files
Fix undefined behaviour in strnatcmp
1 parent 97df260 commit 034e6de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/standard/strnatcmp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len
117117
ca = *ap; cb = *bp;
118118

119119
/* skip over leading zeros */
120-
while (leading && ca == '0' && (ap+1 < aend) && isdigit(*(ap+1))) {
120+
while (leading && ca == '0' && (ap+1 < aend) && isdigit((int)(unsigned char)*(ap+1))) {
121121
ca = *++ap;
122122
}
123123

124-
while (leading && cb == '0' && (bp+1 < bend) && isdigit(*(bp+1))) {
124+
while (leading && cb == '0' && (bp+1 < bend) && isdigit((int)(unsigned char)*(bp+1))) {
125125
cb = *++bp;
126126
}
127127

0 commit comments

Comments
 (0)