Skip to content

Commit 222eb37

Browse files
committed
[SR-7112] 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 222eb37

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CoreFoundation/String.subproj/CFStringEncodings.c

+1-1
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)