summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOneric <oneric@oneric.stub>2022-05-07 03:00:24 +0200
committerOneric <oneric@oneric.stub>2022-05-07 22:26:38 +0200
commitdf8e07544f141aae696f4dc5b4ec8f5eb2227f16 (patch)
treea3cb1817ef1e22fc3bea0a459254aadf26c4424a
parenta6ae1d2fb30551570bd2fee094e1eb9e5c632afe (diff)
downloadlibass-df8e07544f141aae696f4dc5b4ec8f5eb2227f16.tar.bz2
libass-df8e07544f141aae696f4dc5b4ec8f5eb2227f16.tar.xz
Avoid passing NULL to printf's %s if argc == 0
This is undefined behaviour even if most libcs handle it gracefully.
-rw-r--r--compare/compare.c2
-rw-r--r--profile/profile.c3
-rw-r--r--test/test.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/compare/compare.c b/compare/compare.c
index ee1966b..3cb3cff 100644
--- a/compare/compare.c
+++ b/compare/compare.c
@@ -570,7 +570,7 @@ fail:
free(pos);
const char *fmt =
"Usage: %s ([-i] <input-dir>)+ [-o <output-dir>] [-s <scale:1-8>] [-p <pass-level:0-3>]\n";
- printf(fmt, argv[0]);
+ printf(fmt, argv[0] ? argv[0] : "compare");
return NULL;
}
diff --git a/profile/profile.c b/profile/profile.c
index 3740a6c..28b818d 100644
--- a/profile/profile.c
+++ b/profile/profile.c
@@ -68,7 +68,8 @@ int main(int argc, char *argv[])
const int frame_h = 720;
if (argc < 5) {
- printf("usage: %s <subtitle file> <start time> <fps> <end time>\n", argv[0]);
+ printf("usage: %s <subtitle file> <start time> <fps> <end time>\n",
+ argv[0] ? argv[0] : "profile");
exit(1);
}
char *subfile = argv[1];
diff --git a/test/test.c b/test/test.c
index f1de28f..b9754c9 100644
--- a/test/test.c
+++ b/test/test.c
@@ -199,7 +199,7 @@ int main(int argc, char *argv[])
if (argc != 4 && argc != 6) {
printf("usage: %s <image file> <subtitle file> <time> "
"[<storage width> <storage height>]\n",
- argv[0]);
+ argv[0] ? argv[0] : "test");
exit(1);
}
char *imgfile = argv[1];