libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit ae82268cd73d473beb7df532c94cab565e539265
parent 5e9a1a7e08cb7e116eddcd30f9bc528e0dc9ee96
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 12 Jun 2010 23:44:44 +0000

stuff

Diffstat:
Msrc/main/extract.c | 8+++++++-
Msrc/main/extractor.c | 4++--
Msrc/plugins/nsfe_extractor.c | 9++++-----
Msrc/plugins/png_extractor.c | 6++++--
4 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/main/extract.c b/src/main/extract.c @@ -703,7 +703,13 @@ main (int argc, char *argv[]) return -1; } /* end of parsing commandline */ } /* while (1) */ - + if (optind < 0) + { + fprintf (stderr, + "Unknown error parsing options\n"); + free (print); + return -1; + } if (argc - optind < 1) { fprintf (stderr, diff --git a/src/main/extractor.c b/src/main/extractor.c @@ -1463,8 +1463,8 @@ start_process (struct EXTRACTOR_PluginList *plugin) perror ("fdopen"); (void) kill (plugin->cpid, SIGKILL); waitpid (plugin->cpid, &status, 0); - close (p1[0]); - close (p2[1]); + close (p1[1]); + close (p2[0]); plugin->cpid = -1; plugin->flags = EXTRACTOR_OPTION_DISABLED; return; diff --git a/src/plugins/nsfe_extractor.c b/src/plugins/nsfe_extractor.c @@ -159,11 +159,10 @@ libextractor_nsfe_tlbl_extract(const char *data, for (left = size; left > 0; left -= length) { title = nsfestring (&data[size - left], left); - if (title != NULL) - { - length = strlen (title) + 1; - ADDF (title, EXTRACTOR_METATYPE_TITLE); - } + if (title == NULL) + return 0; + length = strlen (title) + 1; + ADDF (title, EXTRACTOR_METATYPE_TITLE); } return 0; } diff --git a/src/plugins/png_extractor.c b/src/plugins/png_extractor.c @@ -100,6 +100,8 @@ processtEXt (const char *data, if (off >= length) return 0; /* failed to find '\0' */ keyword = EXTRACTOR_common_convert_to_utf8 (&data[off], length - off, "ISO-8859-1"); + if (keyword == NULL) + return 0; i = 0; ret = 0; while (tagmap[i].name != NULL) @@ -249,8 +251,8 @@ processzTXt (const char *data, int i; char *buf; uLongf bufLen; - int ret; int zret; + int ret; data += 4; off = stnlen (data, length) + 1; @@ -259,7 +261,7 @@ processzTXt (const char *data, if (data[off] != 0) return 0; /* compression method must be 0 */ off++; - + ret = 0; bufLen = 1024 + 2 * (length - off); while (1) {