Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Update ImageMagick from 7.1.1-19 -> 7.1.1-20
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow authored Oct 9, 2023
1 parent d6a7fa8 commit 04c5718
Show file tree
Hide file tree
Showing 643 changed files with 317 additions and 132 deletions.
2 changes: 1 addition & 1 deletion Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ OPENCL_INCLUDE_PATH := $(OPENCL_PATH)/qualcomm/include

LTDL_LIB_PATH := $(LOCAL_PATH)/libltdl-2.4.6

IMAGE_MAGICK_BASEDIR := ImageMagick-7.1.1-19
IMAGE_MAGICK_BASEDIR := ImageMagick-7.1.1-20
IMAGE_MAGICK := $(LOCAL_PATH)/$(IMAGE_MAGICK_BASEDIR)

JPEG_LIB_PATH := $(LOCAL_PATH)/libjpeg-turbo-2.0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ namespace MagickCore
# pragma comment(lib, "CORE_DB_cairo_.lib")
# endif
# if defined(MAGICKCORE_OPENEXR_DELEGATE)
# pragma comment(lib, "CORE_DB_deflate_.lib")
# pragma comment(lib, "CORE_DB_exr_.lib")
# endif
# if defined(MAGICKCORE_FLIF_DELEGATE)
Expand Down Expand Up @@ -199,6 +200,7 @@ namespace MagickCore
# pragma comment(lib, "CORE_RL_cairo_.lib")
# endif
# if defined(MAGICKCORE_OPENEXR_DELEGATE)
# pragma comment(lib, "CORE_RL_deflate_.lib")
# pragma comment(lib, "CORE_RL_exr_.lib")
# endif
# if defined(MAGICKCORE_FLIF_DELEGATE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ extern MagickPrivate void
GetPixelCacheTileSize(const Image *,size_t *,size_t *),
GetPixelCacheMethods(CacheMethods *),
ResetCacheAnonymousMemory(void),
ResetPixelCacheEpoch(void),
ResetPixelCacheChannels(Image *),
SetPixelCacheMethods(Cache,CacheMethods *);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@ static SemaphoreInfo

static ssize_t
cache_anonymous_memory = (-1);

static time_t
cache_epoch = 0;

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -1694,35 +1691,25 @@ static Cache GetImagePixelCache(Image *image,const MagickBooleanType clone,
status;

static MagickSizeType
cache_timelimit = MagickResourceInfinity,
cpu_throttle = MagickResourceInfinity,
cycles = 0;

status=MagickTrue;
if (cpu_throttle == MagickResourceInfinity)
cpu_throttle=GetMagickResourceLimit(ThrottleResource);
if ((cpu_throttle != 0) && ((cycles++ % 4096) == 0))
MagickDelay(cpu_throttle);
if (cache_epoch == 0)
{
/*
Set the expire time in seconds.
*/
cache_timelimit=GetMagickResourceLimit(TimeResource);
cache_epoch=GetMagickTime();
}
if ((cache_timelimit != MagickResourceInfinity) &&
((MagickSizeType) (GetMagickTime()-cache_epoch) >= cache_timelimit))
if ((cycles++ % 4096) == 0)
{
#if defined(ECANCELED)
errno=ECANCELED;
#endif
cache_info=(CacheInfo *) image->cache;
if (cache_info->file != -1)
(void) ClosePixelCacheOnDisk(cache_info);
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitFatalError,"TimeLimitExceeded","`%s'",image->filename);
return((Cache) NULL);
if (GetMagickTTL() <= 0)
{
cache_info=(CacheInfo *) image->cache;
if (cache_info->file != -1)
(void) ClosePixelCacheOnDisk(cache_info);
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitFatalError,"TimeLimitExceeded","`%s'",image->filename);
return((Cache) NULL);
}
if (cpu_throttle != 0)
MagickDelay(cpu_throttle);
}
LockSemaphoreInfo(image->semaphore);
assert(image->cache != (Cache) NULL);
Expand Down Expand Up @@ -2694,14 +2681,22 @@ static inline ssize_t EdgeY(const ssize_t y,const size_t rows)
return(y);
}

static inline MagickBooleanType IsOffsetOverflow(const ssize_t x,
const ssize_t y)
{
if (((y > 0) && (x > (MAGICK_SSIZE_MAX-y))) ||
((y < 0) && (x < (MAGICK_SSIZE_MIN-y))))
return(MagickFalse);
return(MagickTrue);
}

static inline MagickBooleanType IsValidOffset(const ssize_t y,
const size_t columns)
{
if (columns == 0)
return(MagickTrue);
if (y >= (MAGICK_SSIZE_MAX/(ssize_t) columns))
return(MagickFalse);
if (y <= (MAGICK_SSIZE_MIN/(ssize_t) columns))
if ((y >= (MAGICK_SSIZE_MAX/(ssize_t) columns)) ||
(y <= (MAGICK_SSIZE_MIN/(ssize_t) columns)))
return(MagickFalse);
return(MagickTrue);
}
Expand Down Expand Up @@ -2802,8 +2797,10 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
return((const Quantum *) NULL);
if (IsValidOffset(nexus_info->region.y,cache_info->columns) == MagickFalse)
return((const Quantum *) NULL);
offset=nexus_info->region.y*(MagickOffsetType) cache_info->columns+
nexus_info->region.x;
offset=nexus_info->region.y*(MagickOffsetType) cache_info->columns;
if (IsOffsetOverflow(offset,nexus_info->region.x) == MagickFalse)
return((const Quantum *) NULL);
offset+=nexus_info->region.x;
length=(MagickSizeType) (nexus_info->region.height-1L)*cache_info->columns+
nexus_info->region.width-1L;
number_pixels=(MagickSizeType) cache_info->columns*cache_info->rows;
Expand Down Expand Up @@ -4859,29 +4856,6 @@ MagickPrivate void ResetCacheAnonymousMemory(void)
% %
% %
% %
+ R e s e t P i x e l C a c h e E p o c h %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ResetPixelCacheEpoch() resets the pixel cache epoch.
%
% The format of the ResetPixelCacheEpoch method is:
%
% void ResetPixelCacheEpoch(void)
%
*/
MagickPrivate void ResetPixelCacheEpoch(void)
{
cache_epoch=0;
}

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e s h a p e P i x e l C a c h e %
% %
% %
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
#include "MagickCore/statistic.h"
#include "MagickCore/statistic-private.h"
#include "MagickCore/string_.h"
#include "MagickCore/timer-private.h"
#include "MagickCore/thread-private.h"
#include "MagickCore/threshold.h"
#include "MagickCore/token.h"
Expand Down Expand Up @@ -529,6 +530,7 @@ static const SymbolT Symbols[] = {
/* Run-time controls are in the RPN, not explicitly in the input string. */
typedef enum {
rGoto = FirstCont,
rGotoChk,
rIfZeroGoto,
rIfNotZeroGoto,
rCopyFrom,
Expand All @@ -545,6 +547,7 @@ typedef struct {

static const ControlT Controls[] = {
{rGoto, "goto", 0},
{rGotoChk, "gotochk", 0},
{rIfZeroGoto, "ifzerogoto", 1},
{rIfNotZeroGoto, "ifnotzerogoto", 1},
{rCopyFrom, "copyfrom", 0},
Expand Down Expand Up @@ -652,6 +655,7 @@ typedef struct {
fxFltType * ValStack;
fxFltType * UserSymVals;
Quantum * thisPixel;
MagickSizeType loopCount;
} fxRtT;

struct _FxInfo {
Expand Down Expand Up @@ -995,6 +999,9 @@ static MagickBooleanType AllocFxRt (FxInfo * pfx, fxRtT * pfxrt)
}
for (i = 0; i < pfx->usedUserSymbols; i++) pfxrt->UserSymVals[i] = (fxFltType) 0;
}

pfxrt->loopCount = 0;

return MagickTrue;
}

Expand Down Expand Up @@ -1055,7 +1062,7 @@ static MagickBooleanType DumpRPN (FxInfo * pfx, FILE * fh)
}
for (i=0; i < pfx->usedElements; i++) {
ElementT * pel = &pfx->Elements[i];
if (pel->oprNum == rGoto || pel->oprNum == rIfZeroGoto || pel->oprNum == rIfNotZeroGoto) {
if (pel->oprNum == rGoto || pel->oprNum == rGotoChk || pel->oprNum == rIfZeroGoto || pel->oprNum == rIfNotZeroGoto) {
if (pel->EleNdx >= 0 && pel->EleNdx < pfx->numElements) {
ElementT * pelDest = &pfx->Elements[pel->EleNdx];
pelDest->nDest++;
Expand Down Expand Up @@ -1230,7 +1237,7 @@ static MagickBooleanType AddAddressingElement (FxInfo * pfx, int oprNum, int Ele
if (!AddElement (pfx, (fxFltType) 0, oprNum)) return MagickFalse;
pel = &pfx->Elements[pfx->usedElements-1];
pel->EleNdx = EleNdx;
if (oprNum == rGoto || oprNum == rIfZeroGoto || oprNum == rIfNotZeroGoto
if (oprNum == rGoto || oprNum == rGotoChk || oprNum == rIfZeroGoto || oprNum == rIfNotZeroGoto
|| oprNum == rZerStk)
{
pel->DoPush = MagickFalse;
Expand Down Expand Up @@ -1824,10 +1831,10 @@ static MagickBooleanType GetFunction (FxInfo * pfx, FunctionE fe)
ndx2 = pfx->usedElements;
if (fe==fWhile) {
pfx->Elements[pfx->usedElements-1].DoPush = MagickFalse;
(void) AddAddressingElement (pfx, rGoto, ndx0);
(void) AddAddressingElement (pfx, rGotoChk, ndx0);
} else if (fe==fDo) {
pfx->Elements[pfx->usedElements-1].DoPush = MagickFalse;
(void) AddAddressingElement (pfx, rGoto, ndx0 + 1);
(void) AddAddressingElement (pfx, rGotoChk, ndx0 + 1);
} else if (fe==fFor) {
(void) AddAddressingElement (pfx, rIfZeroGoto, NULL_ADDRESS); /* address will be ndx3 */
pfx->Elements[pfx->usedElements-1].DoPush = MagickTrue; /* we may need return from for() */
Expand All @@ -1846,7 +1853,7 @@ static MagickBooleanType GetFunction (FxInfo * pfx, FunctionE fe)
}
if (fe==fFor) {
pfx->Elements[pfx->usedElements-1].DoPush = MagickFalse;
(void) AddAddressingElement (pfx, rGoto, ndx1);
(void) AddAddressingElement (pfx, rGotoChk, ndx1);
}
ndx3 = pfx->usedElements;
break;
Expand Down Expand Up @@ -3170,8 +3177,13 @@ static MagickBooleanType ExecuteRPN (FxInfo * pfx, fxRtT * pfxrt, fxFltType *res
}

for (i=0; i < pfx->usedElements; i++) {
if (i < 0) {
(void) ThrowMagickException (
pfx->exception, GetMagickModule(), OptionError,
"Bad run-time address", "%i", i);
}
ElementT *pel = &pfx->Elements[i];
switch (pel->nArgs) {
switch (pel->nArgs) {
case 0:
break;
case 1:
Expand Down Expand Up @@ -3919,6 +3931,17 @@ static MagickBooleanType ExecuteRPN (FxInfo * pfx, fxRtT * pfxrt, fxFltType *res
assert (pel->EleNdx >= 0);
i = pel->EleNdx-1; /* -1 because 'for' loop will increment. */
break;
case rGotoChk:
assert (pel->EleNdx >= 0);
i = pel->EleNdx-1; /* -1 because 'for' loop will increment. */
if ((pfxrt->loopCount++ % 8192) == 0) {
if (GetMagickTTL() <= 0) {
i = pfx->usedElements-1; /* Do no more opcodes. */
(void) ThrowMagickException (pfx->exception, GetMagickModule(),
ResourceLimitFatalError, "TimeLimitExceeded", "`%s'", img->filename);
}
}
break;
case rIfZeroGoto:
assert (pel->EleNdx >= 0);
if (fabs((double) regA) < MagickEpsilon) i = pel->EleNdx-1;
Expand Down Expand Up @@ -3948,11 +3971,6 @@ static MagickBooleanType ExecuteRPN (FxInfo * pfx, fxRtT * pfxrt, fxFltType *res
(int)pel->oprNum, OprStr(pel->oprNum));
break;
}
if (i < 0) {
(void) ThrowMagickException (
pfx->exception, GetMagickModule(), OptionError,
"Bad run-time address", "%i", i);
}
if (pel->DoPush)
if (!PushVal (pfx, pfxrt, regA, i)) break;
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,7 @@ MagickExport void MagickCoreGenesis(const char *path,
#endif
(void) RegistryComponentGenesis();
(void) MonitorComponentGenesis();
(void) GetMagickTTL();
magickcore_instantiated=MagickTrue;
UnlockMagickMutex();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,9 @@ static MagickBooleanType ValidateXMPProfile(Image *image,
/*
Validate XMP profile.
*/
const char *artifact=GetImageArtifact(image,"xmp:validate");
if (IsStringTrue(artifact) == MagickFalse)
return(MagickTrue);
document=xmlReadMemory((const char *) GetStringInfoDatum(profile),(int)
GetStringInfoLength(profile),"xmp.xml",NULL,XML_PARSE_NOERROR |
XML_PARSE_NOWARNING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3039,6 +3039,11 @@ MagickExport Image *MagnifyImage(const Image *image,ExceptionInfo *exception)

p=GetCacheViewVirtualPixels(image_view,x-width/2,y-width/2,width,width,
exception);
if (p == (Quantum *) NULL)
{
status=MagickFalse;
continue;
}
channels=GetPixelChannels(source_image);
scaling_method(source_image,p,r,channels);
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
*/
#include "MagickCore/studio.h"
#include "MagickCore/cache.h"
#include "MagickCore/cache-private.h"
#include "MagickCore/configure.h"
#include "MagickCore/exception.h"
#include "MagickCore/exception-private.h"
Expand All @@ -63,6 +62,7 @@
#include "MagickCore/string-private.h"
#include "MagickCore/splay-tree.h"
#include "MagickCore/thread-private.h"
#include "MagickCore/timer-private.h"
#include "MagickCore/token.h"
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
Expand Down Expand Up @@ -126,8 +126,8 @@ static ResourceInfo
MagickULLConstant(0), /* initial thread */
MagickULLConstant(0), /* initial throttle */
MagickULLConstant(0), /* initial time */
(MagickSizeType) (SSIZE_MAX/sizeof(Quantum)/MaxPixelChannels), /* width limit */
(MagickSizeType) (SSIZE_MAX/sizeof(Quantum)/MaxPixelChannels), /* height limit */
(MagickSizeType) (MAGICK_SSIZE_MAX/sizeof(Quantum)/MaxPixelChannels), /* width limit */
(MagickSizeType) (MAGICK_SSIZE_MAX/sizeof(Quantum)/MaxPixelChannels), /* height limit */
MagickResourceInfinity, /* list length limit */
MagickULLConstant(3072)*1024*1024, /* area limit */
MagickULLConstant(1536)*1024*1024, /* memory limit */
Expand All @@ -136,7 +136,7 @@ static ResourceInfo
MagickULLConstant(768), /* file limit */
MagickULLConstant(1), /* thread limit */
MagickULLConstant(0), /* throttle limit */
MagickResourceInfinity /* time limit */
(MagickSizeType) MAGICK_SSIZE_MAX /* time limit */
};

static SemaphoreInfo
Expand Down Expand Up @@ -1488,7 +1488,8 @@ MagickExport MagickBooleanType SetMagickResourceLimit(const ResourceType type,
else
resource_info.time_limit=MagickMin(limit,StringToMagickSizeType(value,
100.0));
ResetPixelCacheEpoch();
resource_info.time_limit=MagickMin(resource_info.time_limit,
(MagickSizeType) MAGICK_SSIZE_MAX);
break;
}
case WidthResource:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ static inline void GetMagickLocaltime(const time_t *timep,struct tm *result)
#endif
}

extern MagickPrivate MagickOffsetType
GetMagickTTL(void);

extern MagickExport time_t
GetMagickTime(void);

Expand Down
Loading

0 comments on commit 04c5718

Please sign in to comment.