Skip to content

Commit cfac32b

Browse files
authored
Merge pull request #2804 from drexin/wip-fix-muloti4-issue
2 parents 84f581d + 84a1e40 commit cfac32b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

CoreFoundation/URL.subproj/CFURLComponents_URIParser.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,11 @@ CF_EXPORT CFStringRef _CFStringCreateByAddingPercentEncodingWithAllowedCharacter
280280
}
281281
else {
282282
// not big enough? malloc it.
283-
size_t mallocSize;
283+
CFIndex mallocSize;
284284
if ( _CFMultiplyBufferSizeWithoutOverflow(maxBufferSize, 4, &mallocSize) ) {
285-
inBuf = (UInt8 *)malloc(mallocSize);
285+
if (mallocSize >= 0) {
286+
inBuf = (UInt8 *)malloc(mallocSize);
287+
}
286288
}
287289
}
288290
if ( inBuf ) {
@@ -455,9 +457,11 @@ CF_EXPORT CFStringRef _CFStringCreateByRemovingPercentEncoding(CFAllocatorRef al
455457
}
456458
else {
457459
// not big enough? malloc it.
458-
size_t mallocSize;
460+
CFIndex mallocSize;
459461
if ( _CFMultiplyBufferSizeWithoutOverflow(maxBufferSize, 2, &mallocSize) ) {
460-
encodedBuf = (UInt8 *)malloc(mallocSize);
462+
if (mallocSize >= 0) {
463+
encodedBuf = (UInt8 *)malloc(mallocSize);
464+
}
461465
}
462466
}
463467
if ( encodedBuf ) {

0 commit comments

Comments
 (0)