mirror of
https://github.com/ImageMagick/ImageMagick.git
synced 2026-05-31 11:18:42 +02:00
ver allocate memory, typically used when concatentating strings
This commit is contained in:
+17
-5
@@ -479,8 +479,8 @@ MagickExport MagickBooleanType ConcatenateString(
|
||||
length+=source_length;
|
||||
if (~length < MagickPathExtent)
|
||||
ThrowFatalException(ResourceLimitFatalError,"UnableToConcatenateString");
|
||||
*destination=(char *) ResizeQuantumMemory(*destination,length+
|
||||
MagickPathExtent,sizeof(**destination));
|
||||
*destination=(char *) ResizeQuantumMemory(*destination,
|
||||
OverAllocateMemory(length+MagickPathExtent),sizeof(**destination));
|
||||
if (*destination == (char *) NULL)
|
||||
ThrowFatalException(ResourceLimitFatalError,"UnableToConcatenateString");
|
||||
if (source_length != 0)
|
||||
@@ -527,7 +527,19 @@ MagickExport void ConcatenateStringInfo(StringInfo *string_info,
|
||||
length=string_info->length;
|
||||
if (~length < source->length)
|
||||
ThrowFatalException(ResourceLimitFatalError,"UnableToConcatenateString");
|
||||
SetStringInfoLength(string_info,length+source->length);
|
||||
length+=source->length;
|
||||
if (~length < MagickPathExtent)
|
||||
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
|
||||
string_info->length=length;
|
||||
if (string_info->datum == (unsigned char *) NULL)
|
||||
string_info->datum=(unsigned char *) AcquireQuantumMemory(length+
|
||||
MagickPathExtent,sizeof(*string_info->datum));
|
||||
else
|
||||
string_info->datum=(unsigned char *) ResizeQuantumMemory(
|
||||
string_info->datum,OverAllocateMemory(length+MagickPathExtent),
|
||||
sizeof(*string_info->datum));
|
||||
if (string_info->datum == (unsigned char *) NULL)
|
||||
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
|
||||
(void) memcpy(string_info->datum+length,source->datum,source->length);
|
||||
}
|
||||
|
||||
@@ -2611,8 +2623,8 @@ MagickExport MagickBooleanType SubstituteString(char **string,
|
||||
*/
|
||||
offset=(ssize_t) (p-(*string));
|
||||
extent=strlen(*string)+replace_extent-search_extent+1;
|
||||
*string=(char *) ResizeQuantumMemory(*string,extent+MagickPathExtent,
|
||||
sizeof(*p));
|
||||
*string=(char *) ResizeQuantumMemory(*string,
|
||||
OverAllocateMemory(extent+MagickPathExtent),sizeof(*p));
|
||||
if (*string == (char *) NULL)
|
||||
ThrowFatalException(ResourceLimitFatalError,"UnableToAcquireString");
|
||||
p=(*string)+offset;
|
||||
|
||||
Reference in New Issue
Block a user