summaryrefslogtreecommitdiff
path: root/test/regression/filter-segv.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/regression/filter-segv.c')
-rw-r--r--test/regression/filter-segv.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/regression/filter-segv.c b/test/regression/filter-segv.c
new file mode 100644
index 0000000..761caab
--- /dev/null
+++ b/test/regression/filter-segv.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <parserutils/parserutils.h>
+
+#include "input/filter.h"
+
+#include "testutils.h"
+
+static void *myrealloc(void *ptr, size_t len, void *pw)
+{
+ UNUSED(pw);
+
+ return realloc(ptr, len);
+}
+
+int main(int argc, char **argv)
+{
+ parserutils_filter *input;
+
+ if (argc != 2) {
+ printf("Usage: %s <filename>\n", argv[0]);
+ return 1;
+ }
+
+ assert(parserutils_initialise(argv[1], myrealloc, NULL) ==
+ PARSERUTILS_OK);
+
+ input = parserutils_filter_create("UTF-8", myrealloc, NULL);
+ assert(input);
+
+ parserutils_filter_destroy(input);
+
+ assert(parserutils_finalise(myrealloc, NULL) == PARSERUTILS_OK);
+
+ printf("PASS\n");
+
+ return 0;
+}