Skip to content
Permalink
Browse files Browse the repository at this point in the history
outside the range of representable values of type 'unsigned char' (#3083
)

Co-authored-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
  • Loading branch information
hifoolno and Zhang Xiaohui committed Jan 6, 2021
1 parent fbd9a96 commit 5af1dff
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions MagickCore/quantum-export.c
Expand Up @@ -2530,28 +2530,28 @@ static void ExportIndexQuantum(const Image *image,QuantumInfo *quantum_info,

for (x=((ssize_t) number_pixels-7); x > 0; x-=8)
{
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q=((pixel & 0x01) << 7);
p+=GetPixelChannels(image);
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q|=((pixel & 0x01) << 6);
p+=GetPixelChannels(image);
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q|=((pixel & 0x01) << 5);
p+=GetPixelChannels(image);
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q|=((pixel & 0x01) << 4);
p+=GetPixelChannels(image);
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q|=((pixel & 0x01) << 3);
p+=GetPixelChannels(image);
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q|=((pixel & 0x01) << 2);
p+=GetPixelChannels(image);
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q|=((pixel & 0x01) << 1);
p+=GetPixelChannels(image);
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q|=((pixel & 0x01) << 0);
p+=GetPixelChannels(image);
q++;
Expand All @@ -2561,7 +2561,7 @@ static void ExportIndexQuantum(const Image *image,QuantumInfo *quantum_info,
*q='\0';
for (bit=7; bit >= (ssize_t) (8-(number_pixels % 8)); bit--)
{
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q|=((pixel & 0x01) << (unsigned char) bit);
p+=GetPixelChannels(image);
}
Expand All @@ -2576,17 +2576,17 @@ static void ExportIndexQuantum(const Image *image,QuantumInfo *quantum_info,

for (x=0; x < (ssize_t) (number_pixels-1) ; x+=2)
{
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q=((pixel & 0xf) << 4);
p+=GetPixelChannels(image);
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q|=((pixel & 0xf) << 0);
p+=GetPixelChannels(image);
q++;
}
if ((number_pixels % 2) != 0)
{
pixel=(unsigned char) GetPixelIndex(image,p);
pixel=(unsigned char) ((ssize_t) GetPixelIndex(image,p));
*q=((pixel & 0xf) << 4);
p+=GetPixelChannels(image);
q++;
Expand All @@ -2597,7 +2597,7 @@ static void ExportIndexQuantum(const Image *image,QuantumInfo *quantum_info,
{
for (x=0; x < (ssize_t) number_pixels; x++)
{
q=PopCharPixel((unsigned char) GetPixelIndex(image,p),q);
q=PopCharPixel((unsigned char) ((ssize_t) GetPixelIndex(image,p)),q);
p+=GetPixelChannels(image);
q+=quantum_info->pad;
}
Expand Down

0 comments on commit 5af1dff

Please sign in to comment.