diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-10-29 21:22:05 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-10-29 21:22:05 +0100 |
commit | 7a6a7f54d1f27c6b3520fe8cffebeebc6c272ca0 (patch) | |
tree | 3e17f8969de279e8f73055f306b731d0f096e357 | |
parent | 161aecb855156aadbf167b31341614807ca336ca (diff) | |
download | libextractor-7a6a7f54d1f27c6b3520fe8cffebeebc6c272ca0.tar.gz libextractor-7a6a7f54d1f27c6b3520fe8cffebeebc6c272ca0.zip |
fix #6613
-rw-r--r-- | ChangeLog | 9 | ||||
-rwxr-xr-x | src/plugins/fuzz_default.sh | 17 | ||||
-rw-r--r-- | src/plugins/test_exiv2.c | 14 | ||||
-rw-r--r-- | src/plugins/test_lib.c | 50 | ||||
-rw-r--r-- | src/plugins/test_lib.h | 5 |
5 files changed, 75 insertions, 20 deletions
@@ -1,6 +1,11 @@ | |||
1 | Thu Oct 29 09:20:41 PM CET 2020 | ||
2 | Fix #6613: test failure with latest exiv2 library | ||
3 | (harmless). Add hard timeout for zzuf test suite | ||
4 | on systems where timeout command exists. -CG | ||
5 | |||
1 | Thu Jul 2 15:58:16 CEST 2020 | 6 | Thu Jul 2 15:58:16 CEST 2020 |
2 | Fixed some code that called deprecated libav routines. | 7 | Fixed some code that called deprecated libav routines. |
3 | Improved configure reporting. | 8 | Improved configure reporting. |
4 | Releasing GNU libextractor 1.10. -CG | 9 | Releasing GNU libextractor 1.10. -CG |
5 | 10 | ||
6 | Tue 02 Jun 2020 11:14:43 PM CEST | 11 | Tue 02 Jun 2020 11:14:43 PM CEST |
diff --git a/src/plugins/fuzz_default.sh b/src/plugins/fuzz_default.sh index 8b64539..67292cf 100755 --- a/src/plugins/fuzz_default.sh +++ b/src/plugins/fuzz_default.sh | |||
@@ -14,6 +14,17 @@ then | |||
14 | bindir="$bindir/bin" | 14 | bindir="$bindir/bin" |
15 | fi | 15 | fi |
16 | 16 | ||
17 | if test -x `which zzuf` | ||
18 | then | ||
19 | exit 77 | ||
20 | fi | ||
21 | |||
22 | if test -x `which timeout` | ||
23 | then | ||
24 | TIMEOUT=timeout 15 | ||
25 | else | ||
26 | TIMEOUT="" | ||
27 | fi | ||
17 | 28 | ||
18 | for file in $testdatadir/test* | 29 | for file in $testdatadir/test* |
19 | do | 30 | do |
@@ -26,11 +37,11 @@ do | |||
26 | do | 37 | do |
27 | echo "file $file seed $seed" | 38 | echo "file $file seed $seed" |
28 | zzuf -c -s $seed cat "$file" > "$tmpfile" | 39 | zzuf -c -s $seed cat "$file" > "$tmpfile" |
29 | if ! "$bindir/extract" -i "$tmpfile" > /dev/null | 40 | if ! "$TIMEOUT $bindir/extract" -i "$tmpfile" > /dev/null |
30 | then | 41 | then |
31 | echo "$tmpfile with seed $seed failed" | 42 | echo "$tmpfile with seed $seed failed" |
32 | mv $tmpfile $tmpfile.keep | 43 | mv $tmpfile $tmpfile.keep |
33 | ret=1 | 44 | ret=1 |
34 | fi | 45 | fi |
35 | seed=`expr $seed + 1` | 46 | seed=`expr $seed + 1` |
36 | done | 47 | done |
diff --git a/src/plugins/test_exiv2.c b/src/plugins/test_exiv2.c index e4e5319..f3dae0a 100644 --- a/src/plugins/test_exiv2.c +++ b/src/plugins/test_exiv2.c | |||
@@ -49,9 +49,10 @@ main (int argc, char *argv[]) | |||
49 | EXTRACTOR_METATYPE_GPS_LATITUDE, | 49 | EXTRACTOR_METATYPE_GPS_LATITUDE, |
50 | EXTRACTOR_METAFORMAT_UTF8, | 50 | EXTRACTOR_METAFORMAT_UTF8, |
51 | "text/plain", | 51 | "text/plain", |
52 | "28deg 8' 17.585\" ", | 52 | "28deg 8' (18|17.585)\" ?", |
53 | strlen ("28deg 8' 17.585\" ") + 1, | 53 | strlen ("28deg 8' (18|17.585)\" ?") + 1, |
54 | 0 | 54 | 0, |
55 | .regex = 1 | ||
55 | }, | 56 | }, |
56 | { | 57 | { |
57 | EXTRACTOR_METATYPE_GPS_LONGITUDE_REF, | 58 | EXTRACTOR_METATYPE_GPS_LONGITUDE_REF, |
@@ -65,9 +66,10 @@ main (int argc, char *argv[]) | |||
65 | EXTRACTOR_METATYPE_GPS_LONGITUDE, | 66 | EXTRACTOR_METATYPE_GPS_LONGITUDE, |
66 | EXTRACTOR_METAFORMAT_UTF8, | 67 | EXTRACTOR_METAFORMAT_UTF8, |
67 | "text/plain", | 68 | "text/plain", |
68 | "14deg 14' 21.713\" ", | 69 | "14deg 14' (22|21.713)\" ?", |
69 | strlen ("14deg 14' 21.713\" ") + 1, | 70 | strlen ("14deg 14' (22|21.713)\" ?"), |
70 | 0 | 71 | 0, |
72 | .regex = 1 | ||
71 | }, | 73 | }, |
72 | { | 74 | { |
73 | EXTRACTOR_METATYPE_CAMERA_MAKE, | 75 | EXTRACTOR_METATYPE_CAMERA_MAKE, |
diff --git a/src/plugins/test_lib.c b/src/plugins/test_lib.c index efbe2cf..97d4dc5 100644 --- a/src/plugins/test_lib.c +++ b/src/plugins/test_lib.c | |||
@@ -24,7 +24,8 @@ | |||
24 | */ | 24 | */ |
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include "test_lib.h" | 26 | #include "test_lib.h" |
27 | 27 | #include <sys/types.h> | |
28 | #include <regex.h> | ||
28 | 29 | ||
29 | /** | 30 | /** |
30 | * Function that libextractor calls for each | 31 | * Function that libextractor calls for each |
@@ -57,14 +58,45 @@ process_replies (void *cls, | |||
57 | (sd[i].type != type) || | 58 | (sd[i].type != type) || |
58 | (sd[i].format != format) ) | 59 | (sd[i].format != format) ) |
59 | continue; | 60 | continue; |
60 | if ( (EXTRACTOR_METAFORMAT_BINARY != format) && | 61 | if ( (sd[i].regex) && |
61 | ( (sd[i].data_len != data_len) || | 62 | (EXTRACTOR_METAFORMAT_BINARY != format) ) |
62 | (0 != memcmp (sd[i].data, data, data_len)) ) ) | 63 | { |
63 | continue; | 64 | regex_t re; |
64 | if ( (EXTRACTOR_METAFORMAT_BINARY == format) && | 65 | regmatch_t match; |
65 | ( (sd[i].data_len > data_len) || | 66 | |
66 | (0 != memcmp (sd[i].data, data, sd[i].data_len)) ) ) | 67 | if (0 != |
67 | continue; | 68 | regcomp (&re, |
69 | sd[i].data, | ||
70 | REG_EXTENDED)) | ||
71 | { | ||
72 | fprintf (stderr, | ||
73 | "Not a valid regex: %s\n", | ||
74 | sd[i].data); | ||
75 | abort (); | ||
76 | } | ||
77 | if ( ('\0' != data[data_len - 1]) || | ||
78 | (0 != regexec (&re, | ||
79 | data, | ||
80 | 1, | ||
81 | &match, | ||
82 | 0)) ) | ||
83 | { | ||
84 | regfree (&re); | ||
85 | continue; | ||
86 | } | ||
87 | regfree (&re); | ||
88 | } | ||
89 | else | ||
90 | { | ||
91 | if ( (EXTRACTOR_METAFORMAT_BINARY != format) && | ||
92 | ( (sd[i].data_len != data_len) || | ||
93 | (0 != memcmp (sd[i].data, data, data_len)) ) ) | ||
94 | continue; | ||
95 | if ( (EXTRACTOR_METAFORMAT_BINARY == format) && | ||
96 | ( (sd[i].data_len > data_len) || | ||
97 | (0 != memcmp (sd[i].data, data, sd[i].data_len)) ) ) | ||
98 | continue; | ||
99 | } | ||
68 | 100 | ||
69 | if (NULL != sd[i].data_mime_type) | 101 | if (NULL != sd[i].data_mime_type) |
70 | { | 102 | { |
diff --git a/src/plugins/test_lib.h b/src/plugins/test_lib.h index 9400314..cea36fc 100644 --- a/src/plugins/test_lib.h +++ b/src/plugins/test_lib.h | |||
@@ -63,6 +63,11 @@ struct SolutionData | |||
63 | * terminate the list. | 63 | * terminate the list. |
64 | */ | 64 | */ |
65 | int solved; | 65 | int solved; |
66 | |||
67 | /** | ||
68 | * Treat solution as a regex that must match. | ||
69 | */ | ||
70 | int regex; | ||
66 | }; | 71 | }; |
67 | 72 | ||
68 | 73 | ||