Multiple use-after-free vulnerabilities in gifcolor.c were found in 5.1.2. Two possible consecutive calls to EGifCloseFile with the same first parameter (GifFile) could lead to two calls to free(GifFile) / free(Private->HashTable) / free(Private). In particular, the second call of free(GifFile) appears in egif_lib.c, where there is no check to know if 'ErrorCode!=NULL' for this free. Since Private is freed with the first call to EGifCloseFile, and used during the second call, resulting into use-after-free.
Acknowledgments: Name: Josselin Feist
Upstream bug: https://sourceforge.net/p/giflib/bugs/83/
Created giflib tracking bugs for this issue: Affects: fedora-all [bug 1318264]
Created mingw-giflib tracking bugs for this issue: Affects: fedora-all [bug 1318265]
CVE request: http://seclists.org/oss-sec/2016/q1/657
CVE assignment: http://seclists.org/oss-sec/2016/q1/663
Patch: https://sourceforge.net/p/giflib/code/ci/7287722a6278dd0ab483ab50c0ded6d1dd805a0c/
I believe that was introduced via https://sourceforge.net/p/giflib/code/ci/116179a7d4681dda9afcdd43b5fbfb391b44918b/ RHEL code base does not include this patch and should not be vulnerable. Statement: This issue did not affect the versions of giflib as shipped with Red Hat Enterprise Linux 5, 6, and 7.