summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.c b/main.c
index a51c370..96f4adb 100644
--- a/main.c
+++ b/main.c
@@ -201,6 +201,14 @@ read_stdin(void)
stdin_unused = NULL;
+ /* On empty stdin, provide a dummy buffer and ensure that it is
+ * at least one byte long, due to
+ * https://github.com/google/sanitizers/issues/627 */
+ if (p == NULL) {
+ p = xstrdup("\n");
+ tlen = 1;
+ }
+
return uc_source_new_buffer("[stdin]", p, tlen);
}