Bug 1378760 (CVE-2016-7528)

Summary: CVE-2016-7528 ImageMagick: out of bound access for viff file coder
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: abhgupta, dmcphers, ethan, jhorak, jialiu, jokerman, kseifried, lmeyer, mmccomas, nmurray, pahan, slawomir, tiwillia
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-19 09:09:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1378790    
Bug Blocks: 1378785    

Comment 1 Adam Mariš 2016-09-23 09:35:19 UTC
Created ImageMagick tracking bugs for this issue:

Affects: fedora-all [bug 1378790]

Comment 2 Stefan Cornelius 2016-09-29 10:45:48 UTC
> number_pixels=(MagickSizeType) image->columns*image->rows;
> for (y=0; y < (ssize_t) image->rows; y++)
> {
>   q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
>   if (q == (PixelPacket *) NULL)
>    break;
>   for (x=0; x < (ssize_t) image->columns; x++)
>   {
>       SetPixelRed(q,ScaleCharToQuantum(*p));
>       SetPixelGreen(q,ScaleCharToQuantum(*(p+number_pixels)));
>       SetPixelBlue(q,ScaleCharToQuantum(*(p+2*number_pixels)));
>       if (image->colors != 0)

Depending on the image dimensions, number_pixels can be quite large
> number_pixels=(MagickSizeType) image->columns*image->rows;

This causes problems when adding this to "p" to calculate the address. It could wrap around and cause an access to invalid memory.
>       SetPixelGreen(q,ScaleCharToQuantum(*(p+number_pixels)));
>       SetPixelBlue(q,ScaleCharToQuantum(*(p+2*number_pixels)));

I'm not sure if the upstream patch properly protects against that.

Comment 3 Stefan Cornelius 2017-05-19 09:09:38 UTC

Red Hat Product Security has rated this issue as having Moderate security impact. This issue is not currently planned to be addressed in future updates. For additional information, refer to the Issue Severity Classification: https://access.redhat.com/security/updates/classification/.