aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/gif_extractor.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-11-01 09:07:35 +0100
committerChristian Grothoff <christian@grothoff.org>2017-11-01 09:07:35 +0100
commit7cc63b001ceaf81143795321379c835486d0c92e (patch)
treeb9c999bddb4ea6357aede74dc559e8ae9bdd744d /src/plugins/gif_extractor.c
parentbc2a59d25b35b0e88dab8895cf70b4d18d2844fc (diff)
downloadlibextractor-7cc63b001ceaf81143795321379c835486d0c92e.tar.gz
libextractor-7cc63b001ceaf81143795321379c835486d0c92e.zip
fix misc NULL pointer exceptions
Diffstat (limited to 'src/plugins/gif_extractor.c')
-rw-r--r--src/plugins/gif_extractor.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/gif_extractor.c b/src/plugins/gif_extractor.c
index aae2b82..8ee5807 100644
--- a/src/plugins/gif_extractor.c
+++ b/src/plugins/gif_extractor.c
@@ -43,7 +43,7 @@ gif_read_func (GifFileType *ft,
43 struct EXTRACTOR_ExtractContext *ec = ft->UserData; 43 struct EXTRACTOR_ExtractContext *ec = ft->UserData;
44 void *data; 44 void *data;
45 ssize_t ret; 45 ssize_t ret;
46 46
47 ret = ec->read (ec->cls, 47 ret = ec->read (ec->cls,
48 &data, 48 &data,
49 arg); 49 arg);
@@ -55,7 +55,7 @@ gif_read_func (GifFileType *ft,
55 55
56 56
57/** 57/**
58 * Main entry method for the 'image/gif' extraction plugin. 58 * Main entry method for the 'image/gif' extraction plugin.
59 * 59 *
60 * @param ec extraction context provided to the plugin 60 * @param ec extraction context provided to the plugin
61 */ 61 */
@@ -72,7 +72,7 @@ EXTRACTOR_gif_extract_method (struct EXTRACTOR_ExtractContext *ec)
72 return; /* not a GIF */ 72 return; /* not a GIF */
73#else 73#else
74 int gif_error; 74 int gif_error;
75 75
76 gif_error = 0; 76 gif_error = 0;
77 gif_file = DGifOpen (ec, &gif_read_func, &gif_error); 77 gif_file = DGifOpen (ec, &gif_read_func, &gif_error);
78 if (gif_file == NULL || gif_error != 0) 78 if (gif_file == NULL || gif_error != 0)
@@ -97,8 +97,8 @@ EXTRACTOR_gif_extract_method (struct EXTRACTOR_ExtractContext *ec)
97 return; 97 return;
98 snprintf (dims, 98 snprintf (dims,
99 sizeof (dims), 99 sizeof (dims),
100 "%dx%d", 100 "%dx%d",
101 gif_file->SHeight, 101 gif_file->SHeight,
102 gif_file->SWidth); 102 gif_file->SWidth);
103 if (0 != 103 if (0 !=
104 ec->proc (ec->cls, 104 ec->proc (ec->cls,
@@ -111,7 +111,7 @@ EXTRACTOR_gif_extract_method (struct EXTRACTOR_ExtractContext *ec)
111 return; 111 return;
112 while (1) 112 while (1)
113 { 113 {
114 if (GIF_OK != 114 if (GIF_OK !=
115 DGifGetRecordType (gif_file, 115 DGifGetRecordType (gif_file,
116 &gif_type)) 116 &gif_type))
117 break; 117 break;
@@ -122,6 +122,8 @@ EXTRACTOR_gif_extract_method (struct EXTRACTOR_ExtractContext *ec)
122 if (GIF_OK != 122 if (GIF_OK !=
123 DGifGetExtension (gif_file, &et, &ext)) 123 DGifGetExtension (gif_file, &et, &ext))
124 continue; 124 continue;
125 if (NULL == ext)
126 continue;
125 if (COMMENT_EXT_FUNC_CODE == et) 127 if (COMMENT_EXT_FUNC_CODE == et)
126 { 128 {
127 ec->proc (ec->cls, 129 ec->proc (ec->cls,
@@ -133,7 +135,7 @@ EXTRACTOR_gif_extract_method (struct EXTRACTOR_ExtractContext *ec)
133 (uint8_t) ext[0]); 135 (uint8_t) ext[0]);
134 break; 136 break;
135 } 137 }
136 while ( (GIF_ERROR != 138 while ( (GIF_ERROR !=
137 DGifGetExtensionNext(gif_file, &ext)) && 139 DGifGetExtensionNext(gif_file, &ext)) &&
138 (NULL != ext) ) ; /* keep going */ 140 (NULL != ext) ) ; /* keep going */
139 } 141 }