summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2021-03-25 11:23:55 +0000
committerPhilip Withnall <pwithnall@endlessos.org>2021-03-25 11:23:55 +0000
commitc3eb4a939be863b4ce79a657e558395ba0d559f6 (patch)
tree15bb098403eed4661083ec4b225c0383d5774607
parent55cbc3151743a3714a270f5160a86d6772c1ba4e (diff)
downloadglib-c3eb4a939be863b4ce79a657e558395ba0d559f6.tar.gz
fuzzing: Fix assertion failure in fuzz_paths.c
If operating on a zero-length input, the return values of `g_path_get_basename()` and `g_path_get_dirname()` are correctly `.`. The assertions in the test didn’t account for this. oss-fuzz#32454 Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-rw-r--r--fuzzing/fuzz_paths.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fuzzing/fuzz_paths.c b/fuzzing/fuzz_paths.c
index 1c866445f..fbed84771 100644
--- a/fuzzing/fuzz_paths.c
+++ b/fuzzing/fuzz_paths.c
@@ -19,10 +19,10 @@ LLVMFuzzerTestOneInput (const unsigned char *data, size_t size)
g_assert (skipped_root == NULL || skipped_root <= (const gchar *) nul_terminated_data + size);
basename = g_path_get_basename ((const gchar *) nul_terminated_data);
- g_assert (strlen (basename) <= size);
+ g_assert (strcmp (basename, ".") == 0 || strlen (basename) <= size);
dirname = g_path_get_dirname ((const gchar *) nul_terminated_data);
- g_assert (strlen (dirname) <= size);
+ g_assert (strcmp (dirname, ".") == 0 || strlen (dirname) <= size);
g_free (nul_terminated_data);
g_free (dirname);