Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
ImageMagick.17344
ImageMagick-CVE-2020-25676.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ImageMagick-CVE-2020-25676.patch of Package ImageMagick.17344
Index: ImageMagick-7.0.7-34/MagickCore/pixel.c =================================================================== --- ImageMagick-7.0.7-34.orig/MagickCore/pixel.c 2018-05-20 17:55:43.000000000 +0200 +++ ImageMagick-7.0.7-34/MagickCore/pixel.c 2020-12-04 10:56:42.444581323 +0100 @@ -4448,6 +4448,15 @@ static inline void CatromWeights(const d (*weights)[2]=x-(*weights)[3]-gamma; } +static inline double ConstrainPixelOffset(double x) +{ + if (x < (double) -(SSIZE_MAX-512)) + return((double) -(SSIZE_MAX-512)); + if (x > (double) (SSIZE_MAX-512)) + return((double) (SSIZE_MAX-512)); + return(x); +} + static inline void SplineWeights(const double x,double (*weights)[4]) { double @@ -4474,15 +4483,6 @@ static inline double MeshInterpolate(con return(delta->x*x+delta->y*y+(1.0-delta->x-delta->y)*p); } -/* -static inline ssize_t NearestNeighbor(const double x) -{ - if (x >= 0.0) - return((ssize_t) (x+0.5)); - return((ssize_t) (x-0.5)); -} -*/ - MagickExport MagickBooleanType InterpolatePixelChannel(const Image *image, const CacheView_ *image_view,const PixelChannel channel, const PixelInterpolateMethod method,const double x,const double y, @@ -4518,8 +4518,8 @@ MagickExport MagickBooleanType Interpola status=MagickTrue; *pixel=0.0; traits=GetPixelChannelTraits(image,channel); - x_offset=(ssize_t) floor(x); - y_offset=(ssize_t) floor(y); + x_offset=(ssize_t) floor(ConstrainPixelOffset(x)); + y_offset=(ssize_t) floor(ConstrainPixelOffset(y)); interpolate=method; if (interpolate == UndefinedInterpolatePixel) interpolate=image->interpolate; @@ -4536,8 +4536,8 @@ MagickExport MagickBooleanType Interpola if (interpolate == Average9InterpolatePixel) { count=3; - x_offset=(ssize_t) (floor(x+0.5)-1); - y_offset=(ssize_t) (floor(y+0.5)-1); + x_offset=(ssize_t) (floor(ConstrainPixelOffset(x)+0.5)-1); + y_offset=(ssize_t) (floor(ConstrainPixelOffset(y)+0.5)-1); } else if (interpolate == Average16InterpolatePixel) @@ -4720,8 +4720,8 @@ MagickExport MagickBooleanType Interpola } case NearestInterpolatePixel: { - x_offset=(ssize_t) floor(x+0.5); - y_offset=(ssize_t) floor(y+0.5); + x_offset=(ssize_t) floor(ConstrainPixelOffset(x)+0.5); + y_offset=(ssize_t) floor(ConstrainPixelOffset(y)+0.5); p=GetCacheViewVirtualPixels(image_view,x_offset,y_offset,1,1,exception); if (p == (const Quantum *) NULL) { @@ -4937,8 +4937,8 @@ MagickExport MagickBooleanType Interpola assert(source->signature == MagickCoreSignature); assert(source_view != (CacheView *) NULL); status=MagickTrue; - x_offset=(ssize_t) floor(x); - y_offset=(ssize_t) floor(y); + x_offset=(ssize_t) floor(ConstrainPixelOffset(x)); + y_offset=(ssize_t) floor(ConstrainPixelOffset(y)); interpolate=method; if (interpolate == UndefinedInterpolatePixel) interpolate=source->interpolate; @@ -4955,8 +4955,8 @@ MagickExport MagickBooleanType Interpola if (interpolate == Average9InterpolatePixel) { count=3; - x_offset=(ssize_t) (floor(x+0.5)-1); - y_offset=(ssize_t) (floor(y+0.5)-1); + x_offset=(ssize_t) (floor(ConstrainPixelOffset(x)+0.5)-1); + y_offset=(ssize_t) (floor(ConstrainPixelOffset(y)+0.5)-1); } else if (interpolate == Average16InterpolatePixel) @@ -5220,8 +5220,8 @@ MagickExport MagickBooleanType Interpola } case NearestInterpolatePixel: { - x_offset=(ssize_t) floor(x+0.5); - y_offset=(ssize_t) floor(y+0.5); + x_offset=(ssize_t) floor(ConstrainPixelOffset(x)+0.5); + y_offset=(ssize_t) floor(ConstrainPixelOffset(y)+0.5); p=GetCacheViewVirtualPixels(source_view,x_offset,y_offset,1,1,exception); if (p == (const Quantum *) NULL) { @@ -5504,8 +5504,8 @@ MagickExport MagickBooleanType Interpola assert(image->signature == MagickCoreSignature); assert(image_view != (CacheView *) NULL); status=MagickTrue; - x_offset=(ssize_t) floor(x); - y_offset=(ssize_t) floor(y); + x_offset=(ssize_t) floor(ConstrainPixelOffset(x)); + y_offset=(ssize_t) floor(ConstrainPixelOffset(y)); interpolate=method; if (interpolate == UndefinedInterpolatePixel) interpolate=image->interpolate; @@ -5524,8 +5524,8 @@ MagickExport MagickBooleanType Interpola if (interpolate == Average9InterpolatePixel) { count=3; - x_offset=(ssize_t) (floor(x+0.5)-1); - y_offset=(ssize_t) (floor(y+0.5)-1); + x_offset=(ssize_t) (floor(ConstrainPixelOffset(x)+0.5)-1); + y_offset=(ssize_t) (floor(ConstrainPixelOffset(y)+0.5)-1); } else if (interpolate == Average16InterpolatePixel) { @@ -5849,8 +5849,8 @@ MagickExport MagickBooleanType Interpola } case NearestInterpolatePixel: { - x_offset=(ssize_t) floor(x+0.5); - y_offset=(ssize_t) floor(y+0.5); + x_offset=(ssize_t) floor(ConstrainPixelOffset(x)+0.5); + y_offset=(ssize_t) floor(ConstrainPixelOffset(y)+0.5); p=GetCacheViewVirtualPixels(image_view,x_offset,y_offset,1,1,exception); if (p == (const Quantum *) NULL) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor