Skip to content

Commit 2859794

Browse files
author
Cristy
committed
avoid deadly embrace for recursive MSL/SVG
1 parent 1b0c8b3 commit 2859794

File tree

5 files changed

+15
-23
lines changed

5 files changed

+15
-23
lines changed

coders/msl.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8064,7 +8064,6 @@ ModuleExport size_t RegisterMSLImage(void)
80648064
entry->encoder=(EncodeImageHandler *) WriteMSLImage;
80658065
#endif
80668066
entry->format_type=ImplicitFormatType;
8067-
entry->thread_support^=DecoderThreadSupport;
80688067
entry->description=ConstantString("Magick Scripting Language");
80698068
entry->magick_module=ConstantString("MSL");
80708069
(void) RegisterMagickInfo(entry);

coders/svg.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3892,7 +3892,6 @@ ModuleExport size_t RegisterSVGImage(void)
38923892
entry->encoder=(EncodeImageHandler *) WriteSVGImage;
38933893
entry->seekable_stream=MagickFalse;
38943894
entry->blob_support=MagickFalse;
3895-
entry->thread_support^=DecoderThreadSupport;
38963895
entry->description=ConstantString("ImageMagick's own SVG internal renderer");
38973896
entry->magick=(IsImageFormatHandler *) IsSVG;
38983897
entry->magick_module=ConstantString("SVG");

magick/constitute.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,14 @@ MagickExport Image *ReadImage(const ImageInfo *image_info,
569569
*/
570570
thread_support=GetMagickThreadSupport(magick_info);
571571
if ((thread_support & DecoderThreadSupport) == 0)
572-
LockSemaphoreInfo(read_info->semaphore);
572+
LockSemaphoreInfo(magick_info->semaphore);
573573
status=IsCoderAuthorized(magick_info->magick_module,read_info->magick,
574574
ReadPolicyRights,exception);
575575
image=(Image *) NULL;
576576
if (status != MagickFalse)
577577
image=GetImageDecoder(magick_info)(read_info,exception);
578578
if ((thread_support & DecoderThreadSupport) == 0)
579-
UnlockSemaphoreInfo(read_info->semaphore);
579+
UnlockSemaphoreInfo(magick_info->semaphore);
580580
}
581581
else
582582
{
@@ -607,11 +607,11 @@ MagickExport Image *ReadImage(const ImageInfo *image_info,
607607
MaxTextExtent);
608608
*read_info->filename='\0';
609609
if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
610-
LockSemaphoreInfo(read_info->semaphore);
610+
LockSemaphoreInfo(delegate_info->semaphore);
611611
status=InvokeDelegate(read_info,image,read_info->magick,(char *) NULL,
612612
exception);
613613
if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
614-
UnlockSemaphoreInfo(read_info->semaphore);
614+
UnlockSemaphoreInfo(delegate_info->semaphore);
615615
image=DestroyImageList(image);
616616
read_info->temporary=MagickTrue;
617617
if (status != MagickFalse)
@@ -635,14 +635,14 @@ MagickExport Image *ReadImage(const ImageInfo *image_info,
635635
*/
636636
thread_support=GetMagickThreadSupport(magick_info);
637637
if ((thread_support & DecoderThreadSupport) == 0)
638-
LockSemaphoreInfo(read_info->semaphore);
638+
LockSemaphoreInfo(magick_info->semaphore);
639639
status=IsCoderAuthorized(magick_info->magick_module,read_info->magick,
640640
ReadPolicyRights,exception);
641641
image=(Image *) NULL;
642642
if (status != MagickFalse)
643643
image=(Image *) (GetImageDecoder(magick_info))(read_info,exception);
644644
if ((thread_support & DecoderThreadSupport) == 0)
645-
UnlockSemaphoreInfo(read_info->semaphore);
645+
UnlockSemaphoreInfo(magick_info->semaphore);
646646
}
647647
if (read_info->temporary != MagickFalse)
648648
{
@@ -1253,13 +1253,13 @@ MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info,
12531253
*/
12541254
thread_support=GetMagickThreadSupport(magick_info);
12551255
if ((thread_support & EncoderThreadSupport) == 0)
1256-
LockSemaphoreInfo(write_info->semaphore);
1256+
LockSemaphoreInfo(magick_info->semaphore);
12571257
status=IsCoderAuthorized(magick_info->magick_module,write_info->magick,
12581258
WritePolicyRights,exception);
12591259
if (status != MagickFalse)
12601260
status=GetImageEncoder(magick_info)(write_info,image);
12611261
if ((thread_support & EncoderThreadSupport) == 0)
1262-
UnlockSemaphoreInfo(write_info->semaphore);
1262+
UnlockSemaphoreInfo(magick_info->semaphore);
12631263
}
12641264
else
12651265
{
@@ -1272,11 +1272,11 @@ MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info,
12721272
*/
12731273
*write_info->filename='\0';
12741274
if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
1275-
LockSemaphoreInfo(write_info->semaphore);
1275+
LockSemaphoreInfo(delegate_info->semaphore);
12761276
status=InvokeDelegate(write_info,image,(char *) NULL,
12771277
write_info->magick,exception);
12781278
if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
1279-
UnlockSemaphoreInfo(write_info->semaphore);
1279+
UnlockSemaphoreInfo(delegate_info->semaphore);
12801280
(void) CopyMagickString(image->filename,filename,MaxTextExtent);
12811281
}
12821282
else
@@ -1328,13 +1328,13 @@ MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info,
13281328
*/
13291329
thread_support=GetMagickThreadSupport(magick_info);
13301330
if ((thread_support & EncoderThreadSupport) == 0)
1331-
LockSemaphoreInfo(write_info->semaphore);
1332-
status=IsCoderAuthorized(magick_info->magick_module,
1333-
write_info->magick,WritePolicyRights,exception);
1331+
LockSemaphoreInfo(magick_info->semaphore);
1332+
status=IsCoderAuthorized(magick_info->magick_module,write_info->magick,
1333+
WritePolicyRights,exception);
13341334
if (status != MagickFalse)
13351335
status=GetImageEncoder(magick_info)(write_info,image);
13361336
if ((thread_support & EncoderThreadSupport) == 0)
1337-
UnlockSemaphoreInfo(write_info->semaphore);
1337+
UnlockSemaphoreInfo(magick_info->semaphore);
13381338
}
13391339
}
13401340
}

magick/image.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,14 +1287,12 @@ MagickExport ImageInfo *DestroyImageInfo(ImageInfo *image_info)
12871287
if (image_info->authenticate != (char *) NULL)
12881288
image_info->authenticate=DestroyString(
12891289
image_info->authenticate);
1290+
DestroyImageOptions(image_info);
12901291
if (image_info->cache != (void *) NULL)
12911292
image_info->cache=DestroyPixelCache(image_info->cache);
12921293
if (image_info->profile != (StringInfo *) NULL)
12931294
image_info->profile=(void *) DestroyStringInfo((StringInfo *)
12941295
image_info->profile);
1295-
DestroyImageOptions(image_info);
1296-
if (image_info->semaphore != (SemaphoreInfo *) NULL)
1297-
DestroySemaphoreInfo(&image_info->semaphore);
12981296
image_info->signature=(~MagickCoreSignature);
12991297
image_info=(ImageInfo *) RelinquishMagickMemory(image_info);
13001298
return(image_info);
@@ -1465,7 +1463,6 @@ MagickExport void GetImageInfo(ImageInfo *image_info)
14651463
GetPixelPacketRGBA(TransparentColorRGBA,&image_info->transparent_color);
14661464
image_info->debug=(GetLogEventMask() & ImageEvent) != 0 ? MagickTrue :
14671465
MagickFalse;
1468-
image_info->semaphore=AllocateSemaphoreInfo();
14691466
image_info->signature=MagickCoreSignature;
14701467
}
14711468

magick/image.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,6 @@ struct _ImageInfo
483483

484484
MagickBooleanType
485485
synchronize;
486-
487-
SemaphoreInfo
488-
*semaphore;
489486
};
490487

491488
extern MagickExport ExceptionType

0 commit comments

Comments
 (0)