Skip to content

Commit 3fc19a8

Browse files
committed
Fixed access to memory out of range
Fixed the code accessing outside the range of the character string. When running the test in Xcode, Guard Malloc (libgmalloc) detected it and caused a runtime error.
1 parent d1272be commit 3fc19a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CoreFoundation/String.subproj/CFStringEncodings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ CFIndex __CFStringEncodeByteStream(CFStringRef string, CFIndex rangeLoc, CFIndex
636636
}
637637

638638
CFIndex uninterestingTailLen = buffer ? (rangeLen - MIN(max, rangeLen)) : 0;
639-
while (*ptr < 0x80 && rangeLen > uninterestingTailLen) {
639+
while (rangeLen > uninterestingTailLen && *ptr < 0x80) {
640640
++ptr;
641641
--rangeLen;
642642
}

0 commit comments

Comments
 (0)