windowscodecs: Properly handle empty GIF extension blocks.

Dmitry Timoshkov dmitry at baikal.ru
Wed Jul 15 03:34:34 CDT 2015


This patch should fix remaining crashes reported in the bug 32227.
---
 dlls/windowscodecs/ungif.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/windowscodecs/ungif.c b/dlls/windowscodecs/ungif.c
index b413ff0..c6711c8 100644
--- a/dlls/windowscodecs/ungif.c
+++ b/dlls/windowscodecs/ungif.c
@@ -932,9 +932,17 @@ DGifSlurp(GifFileType * GifFile) {
 
               Extensions->Function = Function;
 
-              /* Create an extension block with our data */
-              if (AddExtensionBlock(Extensions, ExtData[0], &ExtData[1]) == GIF_ERROR)
-                  return (GIF_ERROR);
+              if (ExtData)
+              {
+                  /* Create an extension block with our data */
+                  if (AddExtensionBlock(Extensions, ExtData[0], &ExtData[1]) == GIF_ERROR)
+                      return (GIF_ERROR);
+              }
+              else /* Empty extension block */
+              {
+                  if (AddExtensionBlock(Extensions, 0, NULL) == GIF_ERROR)
+                      return (GIF_ERROR);
+              }
 
               while (ExtData != NULL) {
                   int Len;
-- 
2.4.5




More information about the wine-patches mailing list