Bug 1319666 (CVE-2016-3186) - CVE-2016-3186 libtiff: buffer overflow in gif2tiff
Summary: CVE-2016-3186 libtiff: buffer overflow in gif2tiff
Alias: CVE-2016-3186
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
Depends On: 1319503 1322307 1322309 1322310
Blocks: 1319667
TreeView+ depends on / blocked
Reported: 2016-03-21 10:01 UTC by Andrej Nemec
Modified: 2021-02-17 04:09 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2019-06-08 02:49:58 UTC

Attachments (Terms of Use)
Patch solving this buffer overflow (498 bytes, patch)
2016-04-06 14:05 UTC, Fridrich Strba
fridrich.strba: review?
Details | Diff

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:2053 0 None None None 2019-08-06 12:08:47 UTC

Description Andrej Nemec 2016-03-21 10:01:30 UTC
A buffer overflow vulnerability was reported in libtiff library, in gif2tiff component. A maliciously crafted file could cause the application to crash.

Original bug report with reproducer:


Comment 1 Andrej Nemec 2016-03-21 10:01:34 UTC

Name: Aladdin Mubaied

Comment 2 Huzaifa S. Sidhpurwala 2016-03-30 09:26:38 UTC
Created libtiff tracking bugs for this issue:

Affects: fedora-all [bug 1322307]

Comment 3 Huzaifa S. Sidhpurwala 2016-03-30 09:26:44 UTC
Created mingw-libtiff tracking bugs for this issue:

Affects: fedora-all [bug 1322309]

Comment 4 Huzaifa S. Sidhpurwala 2016-03-30 09:30:18 UTC
Created mingw-libtiff tracking bugs for this issue:

Affects: epel-7 [bug 1322310]

Comment 5 Huzaifa S. Sidhpurwala 2016-03-30 09:40:13 UTC
Also disclosed on oss-security mailing list via:

Comment 6 Fridrich Strba 2016-04-06 14:05:21 UTC
Created attachment 1144235 [details]
Patch solving this buffer overflow

When getc detects that that it is at the end of file, it returns EOF which is a negative number. The exact value depends on implementation, but it is always a negative number. On Linux it is normally -1. That while loop check only if the count is <= 255. If the number count is negative, that condition is satisfied. Nonetheless, in the subsequent fread, the count is casted to size_t where it becomes a huge number, hence the buffer overflow. This patch is adding a check for the return of getc being positive, which solves the buffer overflow.

Comment 7 Henri Salo 2016-05-31 07:39:37 UTC
For your information I noticed additional buffer overflow issue in readgifimage(), which have been reported to upstream in http://bugzilla.maptools.org/show_bug.cgi?id=2552

Comment 8 Henri Salo 2016-06-02 06:17:11 UTC
CVE-2016-5102 has been assigned to buffer overflow issue in readgifimage(), which was reported in http://bugzilla.maptools.org/show_bug.cgi?id=2552

I am not sure how this should be reported to bugzilla.redhat.com as a separate issue.

Comment 9 errata-xmlrpc 2019-08-06 12:08:46 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2019:2053 https://access.redhat.com/errata/RHSA-2019:2053

Note You need to log in before you can comment on or make changes to this bug.