Bug 1301621 (CVE-2016-0775)

Summary: CVE-2016-0775 python-pillow: Buffer overflow in FliDecode.c
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: carnil, miminar, security-response-team, tsmetana
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-08 02:47:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1300660    
Bug Blocks: 1298877, 1301622    

Description Adam Mariš 2016-01-25 14:31:22 UTC
A buffer overflow vulnerability in FliDecode.c was reported, affecting all versions of python-pillow at least from 1.1.7 release.

Vulnerable code:

case 16:
	/* COPY chunk */
    for (y = 0; y < state->ysize; y++) {
    UINT8* buf = (UINT8*) im->image[y];
    memcpy(buf+x, data, state->xsize);
    data += state->xsize;
    }
	break;

x is used in several internal temporary variable roles, but can take a value up to the width of the image from different chunk sizes. im->image[y] is a set of row pointers to segments of memory that are the size of the row. At the max y, this will write the contents of the line off the end of the memory buffer. This writes into python object storage in a region where there are function pointers.

Reproducer and proposed fix can be found in original bug report:

https://bugzilla.redhat.com/show_bug.cgi?id=1300660

Comment 3 Stefan Cornelius 2016-02-03 20:13:53 UTC
Acknowledgements:

Red Hat would like to thank the Pillow project for reporting this issue. Upstream acknowledges Alyssa Besseling as the original reporter.