Skip to content

Commit 55db06d

Browse files
committed
Merge pull request locutusjs#59 from martindrapeau/master
Infinite loop in strnatcasecmp
2 parents 2da66aa + 1855b17 commit 55db06d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

functions/strings/strnatcasecmp.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ function strnatcasecmp (str1, str2) {
114114
} else if (ca > cb) {
115115
return +1;
116116
}
117+
118+
// prevent possible infinite loop
119+
if (ia >= a.length && ib >= b.length) return 0;
117120

118121
++ia;
119122
++ib;

0 commit comments

Comments
 (0)